Sponsored By

Sign in to follow this  
Wargod18

Having Trouble Gettingthis Subroutine To Run In Vb. (fixed)

Recommended Posts

I thought that the colorchange was telling VB what to do but it was just a name. i feel really stupid now.

first i would like to say welcome the worlds newest script kiddie. 2nd i would like to say thank for your help in advance. 3rd i would like to say im not the worlds newest script kiddie anymore.

anyway, i cant get this subroutine to run in VB 6. it gives me a compile error, i have 2 subroutines, one controls the backround color change the other controls the foreground color change. i think the problem is that there both called colorchange how do you fix this. This is the entire code that is related to the problem. The VSBblue, green, red control the backround while the Foreround is controled by the ones with F after them.

P.S. sorry if this is a little confusing but i told you before im a script kiddie. so im new at this.

P.P.S. once this code is fixed if anybody wants to use it in there own project go ahead just give me credit.

errorpv6.jpg

Private Sub VSBblue_Change()
Call ColorChange(VSBred.Value, VSBgreen.Value, VSBblue.Value)
End Sub

Private Sub VSBbluef_Change()
Call ColorChange(VSBredf.Value, VSBGreenf.Value, VSBbluef.Value)
End Sub

Private Sub VSBgreen_Change()
Call ColorChange(VSBred.Value, VSBgreen.Value, VSBblue.Value)
End Sub

Private Sub VSBGreenf_Change()
Call ColorChange(VSBredf.Value, VSBGreenf.Value, VSBbluef.Value)
End Sub

Private Sub VSBredf_Change()
Call ColorChange(VSBredf.Value, VSBGreenf.Value, VSBbluef.Value)
End Sub

Private Sub VSBred_Change()
Call ColorChange(VSBred.Value, VSBgreen.Value, VSBblue.Value)
End Sub

'subroutine that may be called from multiple locations in the program

Private Sub ColorChange(ByRef r As Integer, ByRef g As Integer, ByRef b As Integer)
LBLrgb.Caption = r & "," & g & "," & b
frmDumbProject.BackColor = RGB(r, g, b)
OPThello.BackColor = RGB(r, g, b)
OPTwelcome.BackColor = RGB(r, g, b)
OPThowareyou.BackColor = RGB(r, g, b)
OPT18.BackColor = RGB(r, g, b)
OPT36.BackColor = RGB(r, g, b)
OPT48.BackColor = RGB(r, g, b)
OPTblue.BackColor = RGB(r, g, b)
OPTblack.BackColor = RGB(r, g, b)
OPTwhite.BackColor = RGB(r, g, b)
OPTorange.BackColor = RGB(r, g, b)
OPTYellow.BackColor = RGB(r, g, b)
OPTgreen.BackColor = RGB(r, g, b)
OPTsnap.BackColor = RGB(r, g, b)
OPTarial.BackColor = RGB(r, g, b)
OPTroman.BackColor = RGB(r, g, b)
FRAMessage.BackColor = RGB(r, g, b)
FRAstyle.BackColor = RGB(r, g, b)
FRAsize.BackColor = RGB(r, g, b)
FRAcolor.BackColor = RGB(r, g, b)
FRAfont.BackColor = RGB(r, g, b)
FRAonoff.BackColor = RGB(r, g, b)
CHKBold.BackColor = RGB(r, g, b)
CHKitalic.BackColor = RGB(r, g, b)
CHKunderlined.BackColor = RGB(r, g, b)
CHKstyleonoff.BackColor = RGB(r, g, b)
CHKfontonoff.BackColor = RGB(r, g, b)
CHKmessageonoff.BackColor = RGB(r, g, b)
CHKsizeonoff.BackColor = RGB(r, g, b)
CMDexit.BackColor = RGB(r, g, b)
LBLred.BackColor = RGB(r, g, b)
LBLgreen.BackColor = RGB(r, g, b)
LBLblue.BackColor = RGB(r, g, b)
LBLGreeting.BackColor = RGB(r, g, b)
LBLrgb.BackColor = RGB(r, g, b)
End Sub


'subroutine that may be called from multiple locations in the program

Private Sub ColorChange(ByRef r As Integer, ByRef g As Integer, ByRef b As Integer)
LBLrgbf.Caption = r & "," & g & "," & b
frmDumbProject.ForeColor = RGB(r, g, b)
OPThello.ForeColor = RGB(r, g, b)
OPTwelcome.ForeColor = RGB(r, g, b)
OPThowareyou.ForeColor = RGB(r, g, b)
OPT18.ForeColor = RGB(r, g, b)
OPT36.ForeColor = RGB(r, g, b)
OPT48.ForeColor = RGB(r, g, b)
OPTblue.ForeColor = RGB(r, g, b)
OPTblack.ForeColor = RGB(r, g, b)
OPTwhite.ForeColor = RGB(r, g, b)
OPTorange.ForeColor = RGB(r, g, b)
OPTYellow.ForeColor = RGB(r, g, b)
OPTgreen.ForeColor = RGB(r, g, b)
OPTsnap.ForeColor = RGB(r, g, b)
OPTarial.ForeColor = RGB(r, g, b)
OPTroman.ForeColor = RGB(r, g, b)
FRAMessage.ForeColor = RGB(r, g, b)
FRAstyle.ForeColor = RGB(r, g, b)
FRAsize.ForeColor = RGB(r, g, b)
FRAcolor.ForeColor = RGB(r, g, b)
FRAfont.ForeColor = RGB(r, g, b)
FRAonoff.ForeColor = RGB(r, g, b)
CHKBold.ForeColor = RGB(r, g, b)
CHKitalic.ForeColor = RGB(r, g, b)
CHKunderlined.ForeColor = RGB(r, g, b)
CHKstyleonoff.ForeColor = RGB(r, g, b)
CHKfontonoff.ForeColor = RGB(r, g, b)
CHKmessageonoff.ForeColor = RGB(r, g, b)
CHKsizeonoff.ForeColor = RGB(r, g, b)
CMDexit.ForeColor = RGB(r, g, b)
LBLred.ForeColor = RGB(r, g, b)
LBLgreen.ForeColor = RGB(r, g, b)
LBLblue.ForeColor = RGB(r, g, b)
LBLGreeting.ForeColor = RGB(r, g, b)
LBLrgb.ForeColor = RGB(r, g, b)
LBLrgbf.ForeColor = RGB(r, g, b)
End Sub

Edited by Wargod18

Share this post


Link to post
Share on other sites

Is the function defined twice in your code or is that a copy paste error? A quick google confirms that error is due to subroutines of the same name.

Edited by naraku9333

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this