This is a migrated thread and some comments may be shown as answers.

Filling a from with values from the GridView (VB)

1 Answer 56 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Jesse asked on 18 Aug 2011, 08:03 AM

I want to fill a form with data from a GridView on my main form, this form is brought up when i click on an item in a context menu. Using the standard data grid view in supplied by MS in Visual Studio 2010 my code looks something like this.
Private Sub EditToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EditToolStripMenuItem.Click
       Dim frm As New frmAddEdit
       frm.GUID_User = Me.dgvUsers.Item(0, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString()
       frm.GUID_Group = Me.dgvUsers.Item(1, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString()
       frm.txtADName.Text = Me.dgvUsers.Item(2, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString()
       frm.txtUserName.Text = Me.dgvUsers.Item(3, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString()
       frm.txtEmail.Text = Me.dgvUsers.Item(4, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString()
       frm.txtLogin.Text = Me.dgvUsers.Item(5, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString()
       frm.txtPassword.Text = Me.dgvUsers.Item(6, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString()
       frm.txtTelNo.Text = Me.dgvUsers.Item(7, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString()
       frm.txtFax.Text = Me.dgvUsers.Item(8, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString()
       frm.cbActive.Checked = IIf(Me.dgvUsers.Item(9, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString() = "True", True, False)
       frm.GUID_Company = Me.dgvUsers.Item(10, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString()
       frm.cbLead.Checked = IIf(Me.dgvUsers.Item(11, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString() = "True", True, False)
       frm.cbSplit.Checked = IIf(Me.dgvUsers.Item(12, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString() = "True", True, False)
       frm.cbTelesales.Checked = IIf(Me.dgvUsers.Item(13, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString() = "True", True, False)
       frm.cboOffice.SelectedValue = Me.dgvUsers.Item(14, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString()
       frm.txtAddress.Text = Me.dgvUsers.Item(15, Me.dgvUsers.SelectedCells(0).RowIndex).Value.ToString()
       frm.Text = "Edit User"
   End Sub

Now this works fine with the standard DataGridView but the Telerik GridView says that 'RowIndex' is not a member of 'Telerik.WinControls.UI.GridViewCellInfo'. 
My Question is: How can I get the same effect using the Telerik GridView and what is the Correct syntax for this then.

Also please bear in mind that I am new to the programming game and I am learning as I go along any and all help would be much appreciated. 

1 Answer, 1 is accepted

Sort by
Martin Vasilev
Telerik team
answered on 23 Aug 2011, 08:51 AM
Hello Jesse,

We answered to a similar question in your other forum post. Please, could you confirm that? Let me know if this is not the same case or if you have any other questions.

Best wishes,
Martin Vasilev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Asked by
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Share this question