0

Can someone share an example of a source code in vb.net that can load value in xtragridview from textedit value?
It seems that the syntax is not the same as Datagridview. That's why I am asking here if someone knows DevExpress xtragrid.

I used below code to display the value in the xtragrid view from textEdit value. But it won't work for me.

Private Sub AddtoTableSimpleButton_Click(sender As Object, e As EventArgs) Handles AddtoTableSimpleButton.Click
        GridView.Columns.View.SetRowCellValue(0, "Date", DateTextEdit.Text)
    End Sub
greybeard
  • 2,249
  • 8
  • 30
  • 66
  • Well, honestly you would be far better off showing what you've attempted but will give you a hint as I think you're going down the wrong road from the out set, in effect you don't load data from a text edit to a xtragrid (or a DatGridView for that matter). You use data bindings to Bind both controls to a object of some type (Maybe a DataTable) in code behind the scenes. – Hursey Aug 02 '23 at 04:36
  • If you don't know about data bindings good place to start is [here](https://learn.microsoft.com/en-us/dotnet/desktop/winforms/data/overview?view=netdesktop-7.0) – Hursey Aug 02 '23 at 04:36
  • 1
    @Hursey I used this sample code to display the value from textEdit into gridview, I won't work for me Private Sub AddtoTableSimpleButton_Click(sender As Object, e As EventArgs) Handles AddtoTableSimpleButton.Click GridView.Columns.View.SetRowCellValue(0, "Date", DateTextEdit.Text) End Sub – DeveloperGuy Aug 02 '23 at 08:00
  • SetRowCellValue would be the correct method, but there are a couple potential issues with your code. I say potential because there isn't enough context really. First off, your setting the value of the row at index 0, from memory, this is the AddNew row object of the DataGridView. Next DateTextEdit.Text is a string, going by the column name I suspect you are putting that in a DateTime column with no parsing/casting. – Hursey Aug 02 '23 at 20:22
  • Also wondering about the way you're resolving the View. Again, not enough context but I know from example (Particularly in Master/Detail Xtragrids) the GridView is not always what you expect, you might be better off looking at something like the (FocusedView)[https://docs.devexpress.com/WindowsForms/DevExpress.XtraGrid.GridControl.FocusedView] . – Hursey Aug 02 '23 at 20:31

0 Answers0