-1

I have Gridview and 6 rows in it. Now I want to get the Focused Row Column value when I click any Cells in Corresponding Row. For Example I want to get Student Exam_no, If i click Student name , Address or Department any cell in the same Row I want to get Exam_no. How to Complete my Task ?

  private void gridControl2_Click(object sender, EventArgs e)
    {
        var frm = new New_Invoice();
        frm.Show();
        gridView1.RefreshData();
    }

This code i tried but not work what I except ? Thanks in Advance.

Srihari
  • 2,387
  • 9
  • 51
  • 82
  • look [here](http://stackoverflow.com/questions/12762617/how-to-get-the-selected-row-values-of-devexpress-xtragrid) for exampels – Jens Kloster Nov 06 '13 at 08:32
  • Hi Jens Kloster, Ok i get Row Focused Value now, but my task is that I want the value in another Form. How to get that particular value into Another Form ? – Srihari Nov 06 '13 at 09:36
  • I would send it via the constructor, something like `new New_Invoice(yourValue);` and then `public New_Invoice(string val)` etc. – Jens Kloster Nov 06 '13 at 09:54
  • Hi I used Constructor but now error come like this Object Reference not set ti Instance on Object ? – Srihari Nov 06 '13 at 11:06
  • My code is this `public partial class New_Invoice : DevExpress.XtraEditors.XtraForm { string getOper = "A"; public New_Invoice() { InitializeComponent(); } public New_Invoice(string oper, int invoiceno) { // TODO: Complete member initialization textEdit5.Text = invoiceno.ToString(); // error shown in this line textEdit5.Visible = false; getOper = oper; }` – Srihari Nov 06 '13 at 11:07
  • 1
    Add `InitializeComponent();` as the fist thing, in you new copnstructor – Jens Kloster Nov 06 '13 at 11:36
  • You shoud ask a new question – Jens Kloster Nov 06 '13 at 12:10

1 Answers1

0
Private Sub GridView1_RowCellClick(ByVal sender As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs) Handles GridView1.RowCellClick

    Dim myColumn As String = e.Column.FieldName ' for the datasource column name
           Dim myValue = GridView1.GetFocusedDataRow(myColumn)

    'For a standard one column
    myValue = view.GetFocusedDataRow("ColumnX")

End Sub
Tratak
  • 138
  • 1
  • 9