|
-
Feb 13th, 2008, 03:36 AM
#1
Thread Starter
Addicted Member
Datagrid
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.
-------------------------
-
Feb 13th, 2008, 10:22 AM
#2
Frenzied Member
Re: Datagrid
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...
Code:
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/quickst...pactFramework/ and 'data' on the left column - quite a few examples there
-
Feb 15th, 2008, 06:35 AM
#3
Thread Starter
Addicted Member
Re: Datagrid
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.
-
Feb 17th, 2008, 03:47 AM
#4
Frenzied Member
Re: Datagrid
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 on this subject a while ago that may help and wrote an article for MSDN on the same subject here
They are probably well out of date now, but may help.
-
Feb 19th, 2008, 08:34 AM
#5
Thread Starter
Addicted Member
Re: Datagrid
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|