Hello daniweb,

Need someone to show how to get value from gridview column into textbox.
For example if I have EmailGridview with 2 columns ID, and EMAIL. And would like under gridview to show Email value also in textbox.

I'm still learning vb.net, and I was trying to do many options, but somehow could not get result.

This is nearest, I was with the code:

EmailTextBox.text = EmailGridView.rows(0).cells(email)

But, of course it is not working.

For info, I'm working in visual web developer with asp.net vb.net. Project is mail form.

Thank you in advance for help to anyone.

Hi,

You can try something like this:

EmailTextBox.Text = EmailGridView.Item(1, DataGridView1.SelectedRows(0).Index).Value

Thank Luc001 you for reply.

I have found solution, with your example.

EmailTextBox.text = EmailGridView.rows(0).cells(1).text.ToString

Edited 5 Years Ago by dejanc: n/a

Hi all,

I have a problem with manipulating gridview with a textbox inside the same form. My requirement is I have a gridview
where cell[1] is quantity, cell[2] is a boundfield which shows the rate and cell[3] is discount and i have a textbox
control outside gridview in th form where the user would enter a discount percentage which is to be shown in the
gridview cell[3] and finally the gridview cell[4] must display the net value after discount.

Thank you all please help
Nirmal

hi... anybody want to help me to solved my problem
i want to get value from gridview column into textbox. i have DGS4 as my gridview . and i want to use query like i used bellow. i uses some code from @luc001 but it stil not working.

this is my code :

da2 = New MySqlDataAdapter("select * from pegawai where kode_pegawai='" & TextBoxDataKode.Text & "' ", "server=localhost;User Id=root;database=databasecuti")

ds2 = New DataSet

da2.Fill(ds2, "pegawai")
DGS4.DataSource = ds2.Tables("pegawai")


Dim GridView As New DataView(ds2.Tables("pegawai"))
DGS4.DataSource = GridView

TextBoxDataKode.Text = DGS4.Item(1, GridView.SelectedRows(0).Index).Value

hi... anybody want to help me to solved my problem
i want to get value from gridview column into textbox. i have DGS4 as my gridview . and i want to use query like i used bellow. i uses some code from @luc001 but it stil not working.

this is my code :

da2 = New MySqlDataAdapter("select * from pegawai where kode_pegawai='" & TextBoxDataKode.Text & "' ", "server=localhost;User Id=root;database=databasecuti")

ds2 = New DataSet

da2.Fill(ds2, "pegawai")
DGS4.DataSource = ds2.Tables("pegawai")


Dim GridView As New DataView(ds2.Tables("pegawai"))
DGS4.DataSource = GridView

TextBoxDataKode.Text = DGS4.Item(1, GridView.SelectedRows(0).Index).Value

hi... anybody want to help me to solved my problem
i want to get value from gridview column into textbox. i have DGS4 as my gridview . and i want to use query like i used bellow. i uses some code from @luc001 but it stil not working.

this is my code :

da2 = New MySqlDataAdapter("select * from pegawai where kode_pegawai='" & TextBoxDataKode.Text & "' ", "server=localhost;User Id=root;database=databasecuti")

ds2 = New DataSet

da2.Fill(ds2, "pegawai")
DGS4.DataSource = ds2.Tables("pegawai")


Dim GridView As New DataView(ds2.Tables("pegawai"))
DGS4.DataSource = GridView

TextBoxDataKode.Text = DGS4.Item(1, GridView.SelectedRows(0).Index).Value

hi... anybody want to help me to solved my problem
i want to get value from gridview column into textbox. i have DGS4 as my gridview . and i want to use query like i used bellow. i uses some code from @luc001 but it stil not working.

this is my code :

da2 = New MySqlDataAdapter("select * from pegawai where kode_pegawai='" & TextBoxDataKode.Text & "' ", "server=localhost;User Id=root;database=databasecuti")

ds2 = New DataSet

da2.Fill(ds2, "pegawai")
DGS4.DataSource = ds2.Tables("pegawai")


Dim GridView As New DataView(ds2.Tables("pegawai"))
DGS4.DataSource = GridView

TextBoxDataKode.Text = DGS4.Item(1, GridView.SelectedRows(0).Index).Value

hi... anybody want to help me to solved my problem
i want to get value from gridview column into textbox. i have DGS4 as my gridview . and i want to use query like i used bellow. i uses some code from @luc001 but it stil not working.

this is my code :

da2 = New MySqlDataAdapter("select * from pegawai where kode_pegawai='" & TextBoxDataKode.Text & "' ", "server=localhost;User Id=root;database=databasecuti")

ds2 = New DataSet

da2.Fill(ds2, "pegawai")
DGS4.DataSource = ds2.Tables("pegawai")


Dim GridView As New DataView(ds2.Tables("pegawai"))
DGS4.DataSource = GridView

TextBoxDataKode.Text = DGS4.Item(1, GridView.SelectedRows(0).Index).Value

hi... anybody want to help me to solved my problem
i want to get value from gridview column into textbox. i have DGS4 as my gridview . and i want to use query like i used bellow. i uses some code from @luc001 but it stil not working.

this is my code :

da2 = New MySqlDataAdapter("select * from pegawai where kode_pegawai='" & TextBoxDataKode.Text & "' ", "server=localhost;User Id=root;database=databasecuti")

ds2 = New DataSet

da2.Fill(ds2, "pegawai")
DGS4.DataSource = ds2.Tables("pegawai")


Dim GridView As New DataView(ds2.Tables("pegawai"))
DGS4.DataSource = GridView

TextBoxDataKode.Text = DGS4.Item(1, GridView.SelectedRows(0).Index).Value

hi... anybody want to help me to solved my problem
i want to get value from gridview column into textbox. i have DGS4 as my gridview . and i want to use query like i used bellow. i uses some code from @luc001 but it stil not working.

this is my code :

da2 = New MySqlDataAdapter("select * from pegawai where kode_pegawai='" & TextBoxDataKode.Text & "' ", "server=localhost;User Id=root;database=databasecuti")

ds2 = New DataSet

da2.Fill(ds2, "pegawai")
DGS4.DataSource = ds2.Tables("pegawai")


Dim GridView As New DataView(ds2.Tables("pegawai"))
DGS4.DataSource = GridView

TextBoxDataKode.Text = DGS4.Item(1, GridView.SelectedRows(0).Index).Value

hi... anybody want to help me to solved my problem
i want to get value from gridview column into textbox. i have DGS4 as my gridview . and i want to use query like i used bellow. i uses some code from @luc001 but it stil not working.

this is my code :

da2 = New MySqlDataAdapter("select * from pegawai where kode_pegawai='" & TextBoxDataKode.Text & "' ", "server=localhost;User Id=root;database=databasecuti")

ds2 = New DataSet

da2.Fill(ds2, "pegawai")
DGS4.DataSource = ds2.Tables("pegawai")


Dim GridView As New DataView(ds2.Tables("pegawai"))
DGS4.DataSource = GridView

TextBoxDataKode.Text = DGS4.Item(1, GridView.SelectedRows(0).Index).Value

hi... anybody want to help me to solved my problem
i want to get value from gridview column into textbox. i have DGS4 as my gridview . and i want to use query like i used bellow. i uses some code from @luc001 but it stil not working.

this is my code :

da2 = New MySqlDataAdapter("select * from pegawai where kode_pegawai='" & TextBoxDataKode.Text & "' ", "server=localhost;User Id=root;database=databasecuti")

ds2 = New DataSet

da2.Fill(ds2, "pegawai")
DGS4.DataSource = ds2.Tables("pegawai")


Dim GridView As New DataView(ds2.Tables("pegawai"))
DGS4.DataSource = GridView

TextBoxDataKode.Text = DGS4.Item(1, GridView.SelectedRows(0).Index).Value

hi... anybody want to help me to solved my problem
i want to get value from gridview column into textbox. i have DGS4 as my gridview . and i want to use query like i used bellow. i uses some code from @luc001 but it stil not working.

this is my code :

da2 = New MySqlDataAdapter("select * from pegawai where kode_pegawai='" & TextBoxDataKode.Text & "' ", "server=localhost;User Id=root;database=databasecuti")

ds2 = New DataSet

da2.Fill(ds2, "pegawai")
DGS4.DataSource = ds2.Tables("pegawai")


Dim GridView As New DataView(ds2.Tables("pegawai"))
DGS4.DataSource = GridView

TextBoxDataKode.Text = DGS4.Item(1, GridView.SelectedRows(0).Index).Value

hi... anybody want to help me to solved my problem
i want to get value from gridview column into textbox. i have DGS4 as my gridview . and i want to use query like i used bellow. i uses some code from @luc001 but it stil not working.

this is my code :

da2 = New MySqlDataAdapter("select * from pegawai where kode_pegawai='" & TextBoxDataKode.Text & "' ", "server=localhost;User Id=root;database=databasecuti")

ds2 = New DataSet

da2.Fill(ds2, "pegawai")
DGS4.DataSource = ds2.Tables("pegawai")


Dim GridView As New DataView(ds2.Tables("pegawai"))
DGS4.DataSource = GridView

TextBoxDataKode.Text = DGS4.Item(1, GridView.SelectedRows(0).Index).Value

hi... anybody want to help me to solved my problem
i want to get value from gridview column into textbox. i have DGS4 as my gridview . and i want to use query like i used bellow. i uses some code from @luc001 but it stil not working.

this is my code :

da2 = New MySqlDataAdapter("select * from pegawai where kode_pegawai='" & TextBoxDataKode.Text & "' ", "server=localhost;User Id=root;database=databasecuti")

ds2 = New DataSet

da2.Fill(ds2, "pegawai")
DGS4.DataSource = ds2.Tables("pegawai")


Dim GridView As New DataView(ds2.Tables("pegawai"))
DGS4.DataSource = GridView

TextBoxDataKode.Text = DGS4.Item(1, GridView.SelectedRows(0).Index).Value

use this TextBoxDataKode.Text = DGS4.CurrentRow.Cell(0).Value instead of TextBoxDataKode.Text = DGS4.Item(1, GridView.SelectedRows(0).Index).Value

This question has already been answered. Start a new discussion instead.