|
VB How-To Ask your "How do I do this with VB?" questions in this forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
June 19th, 2005, 04:31 PM
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Color Form
I was wondering if some one could help me out with this form.
http://img147.echo.cx/img147/2613/vb11aw.jpg
Also if some one coud please tell me what is the code to figuring out exponent value?
|
June 20th, 2005, 11:33 AM
|
Registered User
|
|
Join Date: Jun 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
This is what I came up with, usining .selectedIndex to pick the color
If colorComboBox.SelectedIndex = 0 Then
BackColor = Color.Blue
exitButton.BackColor = Color.Green
Not sure if that's what your looking for.
Richard
|
June 20th, 2005, 01:52 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Dear mivvb,
that looks like a school assignment to me :) (what "exponent value" are you talking about)
please start writing some code, and when you get in trouble post it.
Marco
|
June 20th, 2005, 03:26 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
|
|
If the color combobox is called, say, cboColorChoice then you can do something like
If Me.cboColorChoice = "Red" Then
Me.Detail.BackColor = vbRed
Me.cmdButton1.BackColor = vbRed
Else
Me.Detail.BackColor = vbBlue
Me.cmdButton1.BackColor = vbBlue
Endif
As so forth.
Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
|
June 20th, 2005, 04:25 PM
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yes it is part of a school project. I got all the other parts but this.
The code I got for this not much though. I need to be able to click on the combo box and click a color. That will change the forums color and the buttons color. Just like the picture.
Private Sub cboColor_Change()
End Sub
Private Sub cmdExit_Click()
frmColorForm.Hide
frmLoopingConditions.Show
End Sub
Private Sub cmdReset_Click()
End Sub
|
June 20th, 2005, 05:10 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
you need to populate the combo box with a list of colors (if there is no restriction, just pick up a few, like blue, red, green and yellow)
Do it in the form Load event. In the cboColor_Change, you have to assign the color currectly selected to the BackColor property of the form (and of all other controls that need it)
You also need code for the Reset event. Declare a local variable, and in the form load event assign to it the BacColor property. In the Reset event, do the opposite
Marco
BYW what is the "exponent value" of you original post?
|
June 20th, 2005, 06:03 PM
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Never mind the exponent value.
I dont know how to Populate the cbo box. Ive read stuff in my book but it only tells me how to populate it like with numbers from 2005 to 1990. and what is the code to reset?
I found this type of thing in my book
Private Sub cmdReset_Click()
me.lstSkills.Clear
dim x as Variant
for each x in me.chkskills
x.Enabled = True
x.Value = 0
next
End Sub
Thats the only thing in my book that shows clearing the form but I dont know hot to make it for my color form.
|
June 20th, 2005, 06:56 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
In your book the combo is populated using the AddItem method, right? Probably it is done in a loop, correct? Well, forget the loop, and just call three times the AddItem method, specifying three colors.
As for the Reset, sorry but I cannot be more clear than my pervious post: "Declare a local variable, and in the form load event assign to it the BackColor property. In the Reset event, do the opposite". Maybe someone more fluent in English could do it. I am sorry, but in case of assignments I prefer not to write code, only to give suggestions and make corrections.
Marco
|
June 20th, 2005, 10:32 PM
|
Authorized User
|
|
Join Date: Jun 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Allright thanks. Ill try to figure out this thing.. Not that good with VB as you can see.
|
|
|