Sending dropdown values to message box

Soumya1092

Commendable
May 24, 2016
2
0
1,510
0
I am using VB 2013 and trying to send values from a dropdown to a message box, but it's returning 0. My code is as below :

C++:
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim value1 As String
        Dim value2 As String

        value1 = Val(Project_Name.SelectedItem)
        value2 = Val(ComboBox2.SelectedItem)
        Windows.Forms.MessageBox.Show(value1, value2)

    End Sub
Where have I gone wrong? Appreciate any help / suggestion. I am completely new to Vb.net
 

Soumya1092

Commendable
May 24, 2016
2
0
1,510
0
You can use String.Format like :

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim value1 As String
Dim value2 As String
value1 = Project_Name.SelectedItem.ToString()
value2 = ComboBox2.SelectedItem.ToString()
Dim s As String = String.Format("Value 1: {0} value2 : {1}", value1 , value2)
Windows.Forms.MessageBox.Show(s)

End Sub
 
Thread starter Similar threads Forum Replies Date
W Apps General Discussion 1
S Apps General Discussion 3
suryalord Apps General Discussion 1
B Apps General Discussion 2
C Apps General Discussion 2
G Apps General Discussion 0
M Apps General Discussion 7
P Apps General Discussion 1
kep55 Apps General Discussion 4
G Apps General Discussion 0
E Apps General Discussion 2
M Apps General Discussion 1
S Apps General Discussion 3
E Apps General Discussion 1
B Apps General Discussion 4
G Apps General Discussion 1
T Apps General Discussion 5
PCDesignerR Apps General Discussion 3
P Apps General Discussion 1
ImPrettyIrish Apps General Discussion 2

ASK THE COMMUNITY