Hi
I have created three text boxes and a datagrid. Now if i select a row in the datagrid i want those cell values to be displayed in the corresponding textboxes. Can any body help me in this ascept.

Recommended Answers

All 4 Replies

Hi
I have created three text boxes and a datagrid. Now if i select a row in the datagrid i want those cell values to be displayed in the corresponding textboxes. Can any body help me in this ascept.

Hi
I have created three text boxes and a datagrid. Now if i select a row in the datagrid i want those cell values to be displayed in the corresponding textboxes. Can any body help me in this ascept.

to know which row is selected use this

DataGrid1.CurrentRowIndex

to show the value of first column in text box

Me.TextBox1.Text = DataGrid1.Item(DataGrid1.CurrentRowIndex, [B]0[/B])

to know which row is selected use this

DataGrid1.CurrentRowIndex

to show the value of first column in text box

Me.TextBox1.Text = DataGrid1.Item(DataGrid1.CurrentRowIndex, [B]0[/B])

Thanks for the reply. The code worked, now ihave created a button for email and i want to send the text which is in a textbox iam using " Me.mapiSession.SignOn() " for sending but i have missed some thing its not working. Can u help please. iam using .NET 2005 for this code.

Hope a soon reply.
Thanks and regards

Reply to your first query is as below!

Public strTest As String
Private Sub CONTCOLUMN()

Dim contcolumn As New DataGridViewTextBoxColumn

With contcolumn
.HeaderText = strTest
.Name = strTest

End With

DataGridView1.Columns.Insert(1, contcolumn)
End Sub
Public Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CB.SelectedIndexChanged

strTest = CB.SelectedItem
If strTest = "City" Then
CONTCOLUMN()
Else
MsgBox("YOU ARE IN THIS PHASE")
End If
End Sub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.