need help in visual basic.... - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: need help in visual basic.... (/showthread.php?tid=48236) need help in visual basic.... by TheMusicPirate on 07-28-2005 at 05:35 PM
how can i do these things? RE: need help in visual basic.... by Mike on 07-28-2005 at 05:44 PM
To show another form: code: To change the background colour of the form: code: And for the font colour... Well, try doing something like this: code: RE: RE: need help in visual basic.... by TheMusicPirate on 07-28-2005 at 05:49 PM
quote: is there a way for the font and colors, that i can just have them as option buttons? RE: need help in visual basic.... by CookieRevised on 07-29-2005 at 01:06 AM
Not to be rude or something, but why don't you just press F1 (aka read the help files)? quote:Think like a program.... 1) What do you want to do? change a color of a control => change the correct property of a control (.forecolor, .font, etc) 2) How do you determine which color? by the radio buttons => use an "if..then..else", "Select Case", or whatever decision making statement. 3) How do you change the buttons? by clicking the radio buttons => put it in the "Click()" event of the radio buttons. Tell yourself in plain decent english what you need to do exactly and you will have your solution: "If radio button 1 is selected then change the background color of form1 to black" "If radio button 2 is selected then change the background color of form1 to red" Sub Option_Click(Index As Integer) If Option(0).Value = True Then Form1.Backcolor = vbBlack If Option(1).Value = True Then Form1.Backcolor = vbRed If Option(2).Value = True Then Form1.Backcolor = vbGreen If Option(3).Value = True Then Form1.Backcolor = vbBlue 'etc... End Sub in a better way: Sub Option_Click(Index As Integer) If Option(0).Value = True Then Form1.Backcolor = vbBlack ElseIf Option(1).Value = True Then Form1.Backcolor = vbRed ElseIf Option(2).Value = True Then Form1.Backcolor = vbGreen ElseIf Option(3).Value = True Then Form1.Backcolor = vbBlue End If End Sub And because you have heaps of simple if..then..else statements, and because the Click() event is triggered when you click (thus select!) a button it is much better to use: Sub Option_Click(Index As Integer) 'Index is the index of the radio button which was pressed. See the properties toolwindow! Select Case Index Case 0 Form1.Backcolor = vbBlack Case 1 Form1.Backcolor = vbRed Case 2 Form1.Backcolor = vbGreen Case 3 Form1.Backcolor = vbBlue End Select End Sub |