Click here to Skip to main content
11,925,896 members (61,632 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB9.0 VB VB.NET
Hi to all.

I have write the code in the end to fill manually 1 datagridview...
I need some help for add delete and update this datagridview...

Thanks and regards......

Imports System.Data.OleDb
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Con As OleDbConnection
        Dim sqlCmd As OleDbCommand = New OleDbCommand("select * from Movement_roller_H")
        Dim myData As OleDbDataReader
        Con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source =C:\Users\Louisa\Desktop\Roller.mdb")
        sqlCmd.Connection = Con
        myData = sqlCmd.ExecuteReader
        Do While myData.Read
            Dim dgRow As New DataGridViewRow()
            dgRow.Cells(0).Value = myData.GetInt32(0)
            dgRow.Cells(1).Value = myData.GetDateTime(1).ToString("d")
            dgRow.Cells(2).Value = myData.GetString(2)
            Dim strValue3 As String = IIf(myData.IsDBNull(3), "", myData.GetValue(3))
            dgRow.Cells(3).Value = strValue3
            dgRow.Cells(4).Value = myData.GetDateTime(4).ToString("d")
    End Sub
End Class
Posted 25-Apr-11 5:30am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

This[^] may help you.

It has the example with the source code. Hope it would be helpful to you for understanding the operations related to the grid. Additionally it includes paging also.
Sandeep Mewara 25-Apr-11 11:15am
Comment from OP:
Something in VB????????????????
That's Aragon 26-Apr-11 4:06am
Sandeep , Thank you for noticing the language difference. OP can use to convert and understand the syntax.
Sandeep Mewara 26-Apr-11 4:31am
hey that was not my comment... it was OP's.

From my side, C# or Vb, links were enough to move ahead in a given direction. :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

on button event you write:
this is for selected row to remove!


to manipulate in easy way with database is using Table adapter manager! you can easy create querys
Insert INTO
Scalar Queries!
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This[^] could help you.
Sandeep Mewara 25-Apr-11 11:14am
Comment from OP:
Something in VB????????????????

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 26 Apr 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100