jampost
asked on
Working with a data grind in visual studio-Visual Basic 2008 with an SQL 2008 database.
Here’s the deal. This is a VB 2008 Windows Application project with an SQL 2008 database, and I am comparing what I can do with a “data grid view”, with what I can do in a “details view” from the data sources.
When I use the details view, I notice that the cells are actually text boxes which gives me access to their contents programmatically speaking. I could code in a multiplication function like
Dim Result_A As Integer
Result_A = textbox_A.Text * 110
Label_A = Result_A
Is there a way for me to get access to the contents of the cells in a row (record) if the view is a Data Grid View, and write functions similar to those in the Details view?
When I use the details view, I notice that the cells are actually text boxes which gives me access to their contents programmatically speaking. I could code in a multiplication function like
Dim Result_A As Integer
Result_A = textbox_A.Text * 110
Label_A = Result_A
Is there a way for me to get access to the contents of the cells in a row (record) if the view is a Data Grid View, and write functions similar to those in the Details view?
ASKER
EYoung,
Just wanted to let you know that I am working on this. So far I replaced your dgv name with mine, and I had ti declare mine. I added:
Dim dgvCreditorAccounts As New dgvCreditorAccounts
Now I have to some how define dgvCreditorAccounts I admit I am not a pro and I have to research things every now and then.
Just wanted to let you know that I am working on this. So far I replaced your dgv name with mine, and I had ti declare mine. I added:
Dim dgvCreditorAccounts As New dgvCreditorAccounts
Now I have to some how define dgvCreditorAccounts I admit I am not a pro and I have to research things every now and then.
ASKER
EYoung,
I am working with Dollars & Cents which means I need the Decimal data type. RowCount is not a member of Decimal. There probably is a way of getting around this though.
I am working with Dollars & Cents which means I need the Decimal data type. RowCount is not a member of Decimal. There probably is a way of getting around this though.
Now sure why you want to use a RowCount as a member of Decimal. I only use RowCount to confirm that there are rows in the DGV.
You can define a memory variable as a decimal, i.e.
Dim mDecimal_Value As Decimal
Then:
mDecimal_Value = Trim(dgvCreditorAccounts.C urrentRow. Cells(0).V alue)
You can define a memory variable as a decimal, i.e.
Dim mDecimal_Value As Decimal
Then:
mDecimal_Value = Trim(dgvCreditorAccounts.C
ASKER
EYoung,
As a way of declaring and defining I wrote:
Dim dgvCreditorAccounts As Decimal
If dgvCreditorAccounts .RowCount > 0 Then < problem on this line [Rowcount is not a member of Decimal]
Is there another type that will allow 2 decimal places to the right of the decimal point? The data will be money.
As a way of declaring and defining I wrote:
Dim dgvCreditorAccounts As Decimal
If dgvCreditorAccounts .RowCount > 0 Then < problem on this line [Rowcount is not a member of Decimal]
Is there another type that will allow 2 decimal places to the right of the decimal point? The data will be money.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for the help EYoung. I believe I know what to do on this one.
Private Sub dgvMembers_and_Guests_Clic
'First test for rows present then select the appropriate tab on the form based on the Membership Type
If dgvMembers_and_Guests.RowC
mKey = Trim(dgvMembers_and_Guests
mMember_Type = Trim(dgvMembers_and_Guests
srFill_Screen()
Else
mKey = ""
mMember_Type = ""
srClear_Screen()
End If
btnExit.Focus()
End Sub
This returns the values of the first and second cells on the current row that the user clicks in the Data Grid View.