473,657 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with a Combobox

I have a question for people out there, I need the Combobox to change a
label caption when the user picks a certain thing from the list. How do I
code this. I've tried an If Then statement, but it doesn't seem to work.
Somebody please help!

Sep 7 '06 #1
12 3562
"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 02:36:19 GMT bearing the
following fruit:
I have a question for people out there, I need the Combobox to change a
label caption when the user picks a certain thing from the list. How do I
code this. I've tried an If Then statement, but it doesn't seem to work.
Somebody please help!
Post the code that doesn't work.

Anyway,

Private Sub Combo1_Click()
Label1.Caption = Combo1.Text
End Sub

Jan Hyde (VB MVP)

--
Man with hole in pocket feel cocky all day.

Sep 7 '06 #2
Sorry I should have been more specific, When the User picks from a list of
provinces, the label changes to a different tax rate. Like when they pick
"AB" then the label says "6%"

"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:r1******** *************** *********@4ax.c om...
"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 02:36:19 GMT bearing the
following fruit:
> I have a question for people out there, I need the Combobox to change a
label caption when the user picks a certain thing from the list. How do I
code this. I've tried an If Then statement, but it doesn't seem to work.
Somebody please help!

Post the code that doesn't work.

Anyway,

Private Sub Combo1_Click()
Label1.Caption = Combo1.Text
End Sub

Jan Hyde (VB MVP)

--
Man with hole in pocket feel cocky all day.

Sep 7 '06 #3
sorry, the code that doesnt work is

Private Sub cboProvince_Cli ck()
If cboProvince.Lis t = "AB" then LblTax.Caption = "6%"
End Sub
"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:r1******** *************** *********@4ax.c om...
"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 02:36:19 GMT bearing the
following fruit:
> I have a question for people out there, I need the Combobox to change a
label caption when the user picks a certain thing from the list. How do I
code this. I've tried an If Then statement, but it doesn't seem to work.
Somebody please help!

Post the code that doesn't work.

Anyway,

Private Sub Combo1_Click()
Label1.Caption = Combo1.Text
End Sub

Jan Hyde (VB MVP)

--
Man with hole in pocket feel cocky all day.

Sep 7 '06 #4
"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 13:43:37 GMT bearing the
following fruit:
>sorry, the code that doesnt work is

Private Sub cboProvince_Cli ck()
If cboProvince.Lis t = "AB" then LblTax.Caption = "6%"
If cboProvince.Tex t = "AB" then LblTax.Caption = "6%"


>End Sub
"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:r1******* *************** **********@4ax. com...
>"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 02:36:19 GMT bearing the
following fruit:
>> I have a question for people out there, I need the Combobox to change a
label caption when the user picks a certain thing from the list. How do I
code this. I've tried an If Then statement, but it doesn't seem to work.
Somebody please help!

Post the code that doesn't work.

Anyway,

Private Sub Combo1_Click()
Label1.Caption = Combo1.Text
End Sub

Jan Hyde (VB MVP)

--
Man with hole in pocket feel cocky all day.

Jan Hyde (VB MVP)

--
“He’s making a list of chicken and rice,” (Richard Lederer)

Sep 7 '06 #5
huh, thats the same code that i used, doesn't work

"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:om******** *************** *********@4ax.c om...
"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 13:43:37 GMT bearing the
following fruit:
>>sorry, the code that doesnt work is

Private Sub cboProvince_Cli ck()
If cboProvince.Lis t = "AB" then LblTax.Caption = "6%"

If cboProvince.Tex t = "AB" then LblTax.Caption = "6%"


>>End Sub
"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:r1****** *************** ***********@4ax .com...
>>"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 02:36:19 GMT bearing the
following fruit:

I have a question for people out there, I need the Combobox to change
a
label caption when the user picks a certain thing from the list. How do
I
code this. I've tried an If Then statement, but it doesn't seem to work.
Somebody please help!
Post the code that doesn't work.

Anyway,

Private Sub Combo1_Click()
Label1.Caption = Combo1.Text
End Sub

Jan Hyde (VB MVP)

--
Man with hole in pocket feel cocky all day.


Jan Hyde (VB MVP)

--
"He's making a list of chicken and rice," (Richard Lederer)

Sep 7 '06 #6
Sorry for the top post.. how about..

Private Sub cboProvince_Cli ck()
if cboProvince.Lis t(cboProvince.L istIndex) = "AB" then LblTax.Caption =
"6%"
' ... etc.
End Sub
"What the Hell?" <ra**********@g mail.comwrote in message
news:uN1Mg.37$E 67.17@clgrps13. ..
huh, thats the same code that i used, doesn't work

"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:om******** *************** *********@4ax.c om...
>"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 13:43:37 GMT bearing the
following fruit:
>>>sorry, the code that doesnt work is

Private Sub cboProvince_Cli ck()
If cboProvince.Lis t = "AB" then LblTax.Caption = "6%"

If cboProvince.Tex t = "AB" then LblTax.Caption = "6%"


>>>End Sub
"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:r1***** *************** ************@4a x.com...
"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 02:36:19 GMT bearing the
following fruit:

I have a question for people out there, I need the Combobox to
change a
>label caption when the user picks a certain thing from the list. How do
>I
>code this. I've tried an If Then statement, but it doesn't seem to
>work.
>Somebody please help!
>

Post the code that doesn't work.

Anyway,

Private Sub Combo1_Click()
Label1.Caption = Combo1.Text
End Sub

Jan Hyde (VB MVP)

--
Man with hole in pocket feel cocky all day.



Jan Hyde (VB MVP)

--
"He's making a list of chicken and rice," (Richard Lederer)


Sep 7 '06 #7
THANX! That helped SOOO much!

"Raoul Watson" <Wa*****@Intell igenCIA.comwrot e in message
news:K22Mg.9251 $ay1.3085@trndn y08...
Sorry for the top post.. how about..

Private Sub cboProvince_Cli ck()
if cboProvince.Lis t(cboProvince.L istIndex) = "AB" then LblTax.Caption
= "6%"
' ... etc.
End Sub
"What the Hell?" <ra**********@g mail.comwrote in message
news:uN1Mg.37$E 67.17@clgrps13. ..
>huh, thats the same code that i used, doesn't work

"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:om******* *************** **********@4ax. com...
>>"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 13:43:37 GMT bearing the
following fruit:

sorry, the code that doesnt work is

Private Sub cboProvince_Cli ck()
If cboProvince.Lis t = "AB" then LblTax.Caption = "6%"

If cboProvince.Tex t = "AB" then LblTax.Caption = "6%"

End Sub
"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:r1**** *************** *************@4 ax.com...
"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 02:36:19 GMT bearing the
following fruit:
>
> I have a question for people out there, I need the Combobox to
>change a
>>label caption when the user picks a certain thing from the list. How
>>do I
>>code this. I've tried an If Then statement, but it doesn't seem to
>>work.
>>Somebod y please help!
>>
>
Post the code that doesn't work.
>
Anyway,
>
Private Sub Combo1_Click()
Label1.Caption = Combo1.Text
End Sub
>
>
>
Jan Hyde (VB MVP)
>
--
Man with hole in pocket feel cocky all day.
>

Jan Hyde (VB MVP)

--
"He's making a list of chicken and rice," (Richard Lederer)



Sep 7 '06 #8
"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 23:18:50 GMT bearing the
following fruit:
>huh, thats the same code that i used, doesn't work
Then why isn't that the code you posted?

It's important you post your actual code.

J
>"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:om******* *************** **********@4ax. com...
>"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 13:43:37 GMT bearing the
following fruit:
>>>sorry, the code that doesnt work is

Private Sub cboProvince_Cli ck()
If cboProvince.Lis t = "AB" then LblTax.Caption = "6%"

If cboProvince.Tex t = "AB" then LblTax.Caption = "6%"


>>>End Sub
"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:r1***** *************** ************@4a x.com...
"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 02:36:19 GMT bearing the
following fruit:

I have a question for people out there, I need the Combobox to change
a
>label caption when the user picks a certain thing from the list. How do
>I
>code this. I've tried an If Then statement, but it doesn't seem to work.
>Somebody please help!
>

Post the code that doesn't work.

Anyway,

Private Sub Combo1_Click()
Label1.Caption = Combo1.Text
End Sub

Jan Hyde (VB MVP)

--
Man with hole in pocket feel cocky all day.



Jan Hyde (VB MVP)

--
"He's making a list of chicken and rice," (Richard Lederer)

Jan Hyde (VB MVP)

--
The poet had written better poems, but he'd also written verse.

Sep 8 '06 #9
look who cares, the problem is solved now, if you read the last 2 posts, so
why even bother posting that reply
"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:m4******** *************** *********@4ax.c om...
"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 23:18:50 GMT bearing the
following fruit:
>>huh, thats the same code that i used, doesn't work

Then why isn't that the code you posted?

It's important you post your actual code.

J
>>"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:om****** *************** ***********@4ax .com...
>>"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 13:43:37 GMT bearing the
following fruit:

sorry, the code that doesnt work is

Private Sub cboProvince_Cli ck()
If cboProvince.Lis t = "AB" then LblTax.Caption = "6%"

If cboProvince.Tex t = "AB" then LblTax.Caption = "6%"

End Sub
"Jan Hyde" <St***********@ REMOVE.ME.uboot .comwrote in message
news:r1**** *************** *************@4 ax.com...
"What the Hell?" <ra**********@g mail.com>'s wild thoughts
were released on Thu, 07 Sep 2006 02:36:19 GMT bearing the
following fruit:
>
> I have a question for people out there, I need the Combobox to
>change
>a
>>label caption when the user picks a certain thing from the list. How
>>do
>>I
>>code this. I've tried an If Then statement, but it doesn't seem to
>>work.
>>Somebod y please help!
>>
>
Post the code that doesn't work.
>
Anyway,
>
Private Sub Combo1_Click()
Label1.Caption = Combo1.Text
End Sub
>
>
>
Jan Hyde (VB MVP)
>
--
Man with hole in pocket feel cocky all day.
>

Jan Hyde (VB MVP)

--
"He's making a list of chicken and rice," (Richard Lederer)


Jan Hyde (VB MVP)

--
The poet had written better poems, but he'd also written verse.

Sep 8 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2161
by: Piet | last post by:
Hello wxPythoneers. I have a problem with a dialog box derived from wxFrame which has a wxComboBox as main element. Depending on the entry selected from the ComboBox, the dialog box will be populated with a number of controls. This works fine for the first selection of a combobox item, but subsequent selections from the combobox cause problems. This is because the event function for the combobox populates the sizer for the window with...
17
5398
by: Marcin Borkowski | last post by:
Hello I need some small help in the Borland C++ Builder. I need to do something with string in format like "var1|var2|var3|var4|" and add it to some ComboBox (Items -> Add("var1"), Items -> Add("var2") etc.). Help me, please. How can i do it in the "while" function or something? Best regards Martin
6
1802
by: Andi Plotsky | last post by:
Hi - I sent this request last week, but didn't get an answer to my problem - let's try again: In my A2K database, I have a form with 2 Unbound Comboboxes, both of which open up forms to a particular record. One of these comboboxes works perfectly. For some reason the 2nd one WILL NOT autofill. If I enter a number to lookup by typing it in, it ALWAYS says it's not in the list (Error 2237) - but if I select the item, it works fine. I...
11
2794
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field (strPubCity) for Publisher City. These two fields have a many-to-one relationship with tables, (tlkpPubName and tlkpPubCity) respectively. The lookup tables only have one field (strPubName and strPubCity), which is their primary key. I also have...
0
2159
by: Jax | last post by:
I am using a class that inherits from the DataGridTextBoxColumn. It adds a combo box into the column where it displays a selection of choices. The problem I have is that when this comboBox loses focus I lose the selected text. And this next line isn't setting the text in the cell. // code within the custom DataGridComboBoxColumn class this.TextBox.Text = this.ComboBox.SelectedItem.ToString();
1
2492
by: anonymous | last post by:
I've been trying to put a them, please help me out. Here's the major parts of my code: public Form1() { DataSet myDataSet = new DataSet("myDataSet"); DataTable testTable = new DataTable("table"); testTable.Columns.Add("Col1", typeof(Int32)); testTable.Columns.Add("Col2", typeof(String)); testTable.Rows.Add(testTable.NewRow());
17
2671
by: Hazz | last post by:
In this sample code of ownerdraw drawmode, why does the '(ComboBox) sender' line of code need to be there in this event handler? Isn't cboFont passed via the managed heap, not the stack, into this cboFont_DrawItem event handler? Why does it need to be cast? -hazz ,................. cboFont.Items.AddRange(FontFamily.Families); } private void cboFont_DrawItem(object sender,
4
4611
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box bound to a table as a lookup, drawing values from another table to populate the available selections. This all worked fine in VB6. I have distilled the problem down to a simple form drawing data from the Northwind database for a representative...
3
1966
by: Rick Shaw | last post by:
Hi. I am very new to C# and needed help. Use to program in Delphi but switching to C#. I am just starting my very first application and already don't know what to do. Here is what I'm trying to do. I have 2 comboboxes. 1st combobox is filled (dataset binding) with list of companies from the form load. The 2nd combobox, contain list (filled from dataset then bind) of employees where each employee belongs to a specific company. So,...
6
2480
by: active | last post by:
I need a combobox where the items are typed as string - not object. And another where the items are from a class I generated. Can one make such comboboxes from System.Windows.Forms.ComboBox? If that is not practical I appreciate you telling me that? Thanks in advance
0
8402
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8829
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6172
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4164
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.