Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB9.0 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")
        Con.Open()
        sqlCmd.Connection = Con
        myData = sqlCmd.ExecuteReader
 
        Do While myData.Read
            Dim dgRow As New DataGridViewRow()
            dgRow.CreateCells(DataGridView1)
            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")
            DataGridView1.Rows.Add(dgRow)
        Loop
    End Sub
End Class
Posted 25-Apr-11 5:30am
Rate this: bad
good
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.
  Permalink  
Comments
Sandeep Mewara at 25-Apr-11 11:15am
   
Comment from OP:
Something in VB????????????????
That's Aragon at 26-Apr-11 4:06am
   
Sandeep , Thank you for noticing the language difference. OP can use http://www.developerfusion.com/tools/convert/csharp-to-vb/ to convert and understand the syntax.
Sandeep Mewara at 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
good
Please Sign up or sign in to vote.

Solution 4

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

datagridview1.rows.remove(datagridview1.curentrow)
 

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

Solution 1

This[^] could help you.
  Permalink  
Comments
Sandeep Mewara at 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
0 OriginalGriff 295
1 Maciej Los 280
2 Afzaal Ahmad Zeeshan 224
3 BillWoodruff 205
4 Sergey Alexandrovich Kryukov 195
0 OriginalGriff 6,499
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,193
3 Manas Bhardwaj 4,657
4 Maciej Los 4,120


Advertise | Privacy | Mobile
Web03 | 2.8.1411019.1 | Last Updated 26 Apr 2011
Copyright © CodeProject, 1999-2014
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