Need Help On Combo Box & Label!!!

alexkoh

New member
Joined
Mar 19, 2005
Messages
3
Programming Experience
Beginner
hi everyone.

currently im doing a page for displaying some value.

i have a combo box and a label. the combo box have a few choices and whenever user select them. i wish to display some value in the label. i had tried some way n stil unable to solve it.

the code below is for my combo box. jus wondering if anyone could help mi with it? thanks alot. =)


VB.NET:
[left][font=Courier New][color=blue]Private[/color] [color=blue]Sub[/color] ComboBox1_MouseUp([color=blue]ByVal[/color] sender [color=blue]As[/color] [color=blue]Object[/color], [color=blue]ByVal[/color] e [color=blue]As[/color] System.Windows.Forms.MouseEventArgs) [color=blue]Handles[/color] [/font][font=Courier New]ComboBox1.MouseUp[/font][font=Courier New]		[/font][/left]

[left][font=Courier New][color=blue]If[/color] ComboBox1.Text = "Mon" [color=blue]Or[/color] "Tue" [color=blue]Or[/color] "Wed" [color=blue]Or[/color] "Thur" Then [/font][/left]

[left][font=Courier New]		 price.Text = "6.5"[/font][font=Courier New]		[/font][/left]
[left][font=Courier New][color=blue]Else[/color][/font][font=Courier New]			[/font][/left]
[left][font=Courier New][color=green][color=#0000ff]If[/color][color=#000000] ComboBox1.Text =[/color] [color=#000000]"Fri[/color][color=#000000]" [/color][color=blue]Or[/color][color=#000000] "Sat" [/color][color=blue]Or[/color][/color][color=#000000] "Sun" Then [/color][/font][/left]
[left][font=Courier New]		 price.Text = "8"[/font][font=Courier New]		[/font][/left]

[left][font=Courier New][color=blue]End[/color] [color=blue]If[/color][/font][font=Courier New]	[/font][/left]
[left][font=Courier New][color=blue]End[/color] [color=blue]Sub[/color][/font] [/left]
 
Last edited:
try this.
VB.NET:
Dim s() As String = {"mon", "tue", "wed", "thur"}
	Dim x() As String = {"fri", "sat", "sun"}
	Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
		Dim ss As String
		For Each ss In s
			If ComboBox1.Text = ss Then
				Label1.Text = "Price 6.75"
			End If
		Next
		For Each ss In x
			If ComboBox1.Text = ss Then
				Label1.Text = "Price 8.00"
			End If
		Next
	End Sub
 
Back
Top