grid column in vb.net (pocket pc)

  • Thread starter Thread starter Steiner Hubert
  • Start date Start date
S

Steiner Hubert

hello,
i use this code:
toGrid.DataSource = dset.Tables("myTable")

this works fine - but here is my id field visible

-> how can i hide this id column in the grid?
 
Use a DataGridTableStyle (see VS.Net help for more info + examples) and set
the width of the column to 0. That'll also allow you to set the width of
other columns, if need be.
 
hello,
the code:
Dim dadp As New SqlServerCe.SqlCeDataAdapter("SELECT * FROM Mittel", cn)
Dim dset As New DataSet
dadp.Fill(dset, "Mittel")

Dim dgts As New DataGridTableStyle
dgts.MappingName = "Mittel"
Dim c As New DataGridTextBoxColumn
c.MappingName = "Name"
c.HeaderText = "Mittel"
c.Width = 100
dgts.GridColumnStyles.Add(c)
toGrid.TableStyles.Add(dgts)

-> but in the grid no column is visible
please help
 
thank you!

my ID field is in the grid not visible
the user click now in a row

-> how can i determine the id field
at the active row of the grid?
 
sorry, i am a beginner

Dim dadp As New SqlServerCe.SqlCeDataAdapter("SELECT * FROM Mittel", cn)
Dim dset As New DataSet
dadp.Fill(dset, "Mittel")
Dim dgts As New DataGridTableStyle
dgts.MappingName = "Mittel"
Dim c As New DataGridTextBoxColumn
c.MappingName = "Name"
c.HeaderText = "Mittel"
c.Width = 100
dgts.GridColumnStyles.Add(c)
toGrid.TableStyles.Add(dgts)
toGrid.DataSource = dset.Tables("Mittel")

rem ???
dset.Tables("Mittel").DefaultView(toGrid.CurrentRowIndex)("id")
rem ???
 
Create button and implement Click handler for this button. Inside this
handler input the following code snippet that shows current selected
record ID:


MessageBox.Show(dset.Tables("Mittel").DefaultView(toGrid.CurrentRowIndex)("id").ToString())

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
 
Back
Top