Click to See Complete Forum and Search --> : Datagrid
keko9
Feb 13th, 2008, 02:36 AM
Me again about grids:
I have in vb6 mobile pocket pc :
GridCtrl1.Row
GridCtrl1.AddItem
GridCtrl1.Row = GridCtrl1.Rows - 1
GridCtrl1.Col = 1
GridCtrl1.ColWidth(0) = 500
-------------------------
I got on another forum how to use Grid command:
DirectCast(DataGrid1.DataSource,System.Data.DataTable).Rows.Item(index)
The cast depends on the type of your DataSource
-------------------------
I tried like this:
directcast(DataGrid1).Rows.item etc.
But show me error :
Syntax error in cast operator; two arguments separated by comma are required.
-------------------------
petevick
Feb 13th, 2008, 09:22 AM
Hi,
again - instead of trying to translate VB6 to .Net, look at the .Net way of doing it. Can you not bind your grid to a datasource?
Similar to...
Dim objAdapter As SqlCeDataAdapter
Dim objDataset As Data.DataSet
Dim strSQL As String
strSQL = "SELECT * FROM Accounts"
objAdapter = New SqlCeDataAdapter(strSQL, "Data Source = \My Documents\test.sdf")
objDataset = New Data.DataSet()
objAdapter.Fill(objDataset, "Accounts")
dgAccounts.DataSource = objDataset.Tables("Accounts")
Also take a look at http://samples.gotdotnet.com/quickstart/CompactFramework/ and 'data' on the left column - quite a few examples there
keko9
Feb 15th, 2008, 05:35 AM
Am actually upgrading from eVB to .net 2005, and am not friendly really with visual studio.
I had used commands
gridctrl1.Row
gridctrl1.Rows
gridctrl1.Col
gridctrl1.LeftCol
gridctrl1.clear
.colwidth
.rowheight
.rowpos
.colpos
which i cannot fing their eqivalent in vb 2005 , i.e using datagrid
Even for a label in which i used label1.move , in 2005 i can't get the label1.setbounds property.
Can you help me out.
petevick
Feb 17th, 2008, 02:47 AM
The reason why you keep being told it is a re-design and re-write is that in a lot of cases, there is no equivalent statements in .Net for eVB statements.
To set the location of a control
lvEnquiries.Location = New System.Drawing.Point(2 , 67)
I did a webcast on MSDN (http://msevents.microsoft.com/cui/WebCastEventDetails.aspx?culture=en-US&EventID=1032268859&CountryCode=US) on this subject a while ago that may help and wrote an article for MSDN on the same subject here (http://msdn2.microsoft.com/en-us/library/ms838251.aspx)
They are probably well out of date now, but may help.
keko9
Feb 19th, 2008, 07:34 AM
I found example how to select column or row!
Private Sub SetCellValue(ByVal myGrid As DataGrid)
Dim myCell As New DataGridCell()
myCell.RowNumber = myGrid.CurrentRowIndex
myCell.ColumnNumber = 1
myGrid(myCell)= "New Value"
End Sub
Private Sub GetCellValue(ByVal myGrid As DataGrid)
Dim myCell As New DataGridCell()
Dim strValue As string
myCell.RowNumber = myGrid.CurrentRowIndex
myCell.ColumnNumber = 1
strValue = myGrid(myCell)
End Sub
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.