Wrox Programmer Forums
|
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
 
Old June 19th, 2005, 04:31 PM
Authorized User
 
Join Date: Jun 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?

 
Old June 20th, 2005, 11:33 AM
Registered User
 
Join Date: Jun 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default


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

 
Old June 20th, 2005, 01:52 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old June 20th, 2005, 03:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

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
 
Old June 20th, 2005, 04:25 PM
Authorized User
 
Join Date: Jun 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old June 20th, 2005, 05:10 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?
 
Old June 20th, 2005, 06:03 PM
Authorized User
 
Join Date: Jun 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
 
Old June 20th, 2005, 06:56 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old June 20th, 2005, 10:32 PM
Authorized User
 
Join Date: Jun 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Allright thanks. Ill try to figure out this thing.. Not that good with VB as you can see.






Similar Threads
Thread Thread Starter Forum Replies Last Post
change form color when minimized maricar C# 3 September 10th, 2008 07:34 PM
form back color; saidan C# 2005 12 October 29th, 2007 08:16 AM
Form lost focus color change dthrun VB How-To 1 March 30th, 2007 10:41 PM
Highlight and Color records in a continuous form MichaelCree Access VBA 8 March 28th, 2005 05:32 PM
Form Color In VB.NET Sas VB.NET 2002/2003 Basics 3 October 27th, 2004 12:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.