Hi,
I'm new in VB. I do have a datatable with a few columns. The first column having a unique values. How do I want read the particular column value and display it in textbox?
Say the datatable dt
The ColumnA input is based on user input from textbox2. So I make it as variable let say "varA". So how I want to check what's the value for ColumnC based on variable from ColumnA and display it to textbox3?
What I do have now:
Can somebody advice? Thanks in advance.
I'm new in VB. I do have a datatable with a few columns. The first column having a unique values. How do I want read the particular column value and display it in textbox?
Say the datatable dt
Code:
ColumnA ColumnB ColumnC ColumnD
AB 123x 456y 789z
CD 123y 456y 789x
EF 234x 567x 789z
What I do have now:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim varA As String
varA = TextBox2.Text
If dt.Rows.Contains(varA) Then
TextBox3.Text = dt.Rows.Item(2)("ColumnC").ToString '--> this is not work because I need the value based on the varA input by user. Please advice what should do here.
Else
MsgBox("No ColumnA value found", MsgBoxStyle.Critical)
End If
End Sub