3 Years
Discussion Span
Last Post by Emma Etigu

this is really easy,

but dont have time to talk right now.. Im busy I can help you on skype, can send and code if is needed.

PS: a simple way to do this too is to do with tags.

PSS: skype account ID: altjen.ber



thanks for the suggestion but I was wondering, what time can we arrange. my time zone is +3 GMT (East African time).



Im busy I can help you on skype, can send and code if is needed.

If you supply a solution via Skype then it doesn't help anyone else here. If you do this then please post the solution.


I can use skype from phone, but cant surf on this page from there. no idea why. (and use lumia 925)

and most of time Im on phone and less time on pc so for her problems I thought that could help from there, but also gave a good example how to get data from local db only with tags

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

    DataGridView1.Rows.Add({"1", "Pizza", "$20.00"})
    DataGridView1.Rows.Add({"2", "Bun", "$1.00"})
    DataGridView1.Rows.Add({"3", "Burger", "$3.00"})
    DataGridView1.Rows.Add({"4", "Fries", "$2.00"})
    DataGridView1.Rows.Add({"5", "Chicken", "$2.50"})

End Sub

Private Sub DataGridView1_CellClick(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick

    txtNumber.Text = DataGridView1.Rows(e.RowIndex).Cells(0).Value
    txtName.Text = DataGridView1.Rows(e.RowIndex).Cells(1).Value
    txtPrice.Text = DataGridView1.Rows(e.RowIndex).Cells(2).Value

End Sub

I have set DataGridView1 with the following properties

DataGridView1.AllowUserToAddRows = False
DataGridView1.AllowUserToDeleteRows = False
DataGridView1.AllowUserToOrderColumns = True
DataGridView1.AllowUserToResizeRows = False
DataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect

Clicking any cell will cause the entire row to be selected and to copy the corresponding cell values to the text boxes for editing.


thanks a lot. I was able to borrow a leaf from your code snippet to help implement my application. but I need extra assistance regarding getting the sum of the totals.
I have used:

dim sum as decimal
sum+ = daragridview1.rows( I).cells(2).value

but I have a problem, the column has got some null values and I get an error related to DBNull and as such I cannot get the sum.


Edited by Reverend Jim: Corrected code formatting


here is the error message. error: operator '+' is not defined for the type
DBnull and integer..



Does the associated cell have a value in it? If the data is originally from a database you may have to convert nulls to some default value. In MS SQL you can use the COALESCE function. If the null values are because a textbox field is empty then you'll have to ensure that all fields contain values.


I got it. I used:
if not IsDBNull(datagridview1.Rows ( I).cells(2).value) Then
end if

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.