What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » need help in visual basic....

need help in visual basic....
Author: Message:
TheMusicPirate
Full Member
***

Avatar

Posts: 412
Reputation: 8
39 / Male / –
Joined: Feb 2005
O.P. need help in visual basic....
how can i do these things?

i want to link from a command buton to another form

and i want to have options to be able to change the colors of the font and change the background.



thanks.
[Image: ipod.gif]

07-28-2005 05:35 PM
Profile PM Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
31 / Male / Flag
Joined: Mar 2003
RE: need help in visual basic....
To show another form:

code:
frmName.Show

To change the background colour of the form:

code:
frmName.BackColor = vbBlack 'Black

And for the font colour...
Well, try doing something like this:

code:
Dim ctrl as Control
For Each ctrl in Me 'If this doesnt work, try changing Me to Controls
    If TypeOf ctrl is label then
ctrl.Forecolor = vbWhite 'White
Next ctrl
YouTube closed-captions ripper (also allows you to download videos!)
07-28-2005 05:44 PM
Profile E-Mail PM Web Find Quote Report
TheMusicPirate
Full Member
***

Avatar

Posts: 412
Reputation: 8
39 / Male / –
Joined: Feb 2005
O.P. RE: RE: need help in visual basic....
quote:
Originally posted by Mike
To show another form:

code:
frmName.Show

To change the background colour of the form:

code:
frmName.BackColor = vbBlack 'Black

And for the font colour...
Well, try doing something like this:

code:
Dim ctrl as Control
For Each ctrl in Me 'If this doesnt work, try changing Me to Controls
    If TypeOf ctrl is label then
ctrl.Forecolor = vbWhite 'White
Next ctrl


is there a way for the font and colors, that i can just have them as option buttons?
[Image: ipod.gif]

07-28-2005 05:49 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: need help in visual basic....
Not to be rude or something, but why don't you just press F1 (aka read the help files)?

You also can simply type an object's name, enter the point, and a dropdown list will be shown with all available properties... scroll that list and look at the names...

Also, check out the properties window of controls. They very clearly show each property of a control and you cant miss the COLOR settings in there...

[Image: attachment.php?pid=503704]


The stuff you ask for is extremly low level basic knowledge though. Did you read a tutorial on VB first? Or a manual or tut like "VB in 10 steps", "VB for beginners", etc...? As I said, I'm not trying to be rude, but looking at your questions it seems to me that you just begun programming in VB. So it wouldn't hurt if you first read some basic programming tuts for VB (which can be found by thousands on the net). Because if you're stuck with these basic things already, you wont get very far...


---------

quote:
Originally posted by TheMusicPirate
is there a way for the font and colors, that i can just have them as option buttons?
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

.png File Attachment: Image0.png (8.17 KB)
This file has been downloaded 260 time(s).

This post was edited on 07-29-2005 at 01:26 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-29-2005 01:06 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On