HighTechTalks DotNet Forums  

Help With Custom Paging in DataGridView - VB.Net 2008

VB.net microsoft.public.dotnet.languages.vb


Discuss Help With Custom Paging in DataGridView - VB.Net 2008 in the VB.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Ryan
 
Posts: n/a

Default Help With Custom Paging in DataGridView - VB.Net 2008 - 01-18-2010 , 06:18 PM






How do I add custom paging to the following code?

Public Class Form2

Private PageCount As Integer
Private maxRec As Integer
Private pageSize As Integer
Private currentPage As Integer
Private recNo As Integer

Private ds As New DataSet
Private dt As New DataTable
Private da As OracleDataAdapter
Private dv As DataView

Private dtTemp As DataTable
Private myBindingSource As BindingSource
Private myDataSet As DataSet

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

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
LoadData("select * from Contact")
End Sub

Private Sub LoadData(ByVal str As String)
Try
Dim myCMD As New OracleCommand()
gsCnnString = CreateConnection()
Using objConn As New OracleConnection(gsCnnString)
Dim objCmd As New OracleCommand()
objCmd.Connection = objConn
objCmd.CommandText = str
objCmd.CommandType = CommandType.Text

Try
Dim oAdapter As OracleDataAdapter
oAdapter = New OracleDataAdapter(str, objConn)
myDataSet = New DataSet()
oAdapter.Fill(myDataSet)

myBindingSource = New BindingSource()
myBindingSource.DataSource = myDataSet
myBindingSource.DataMember = myDataSet.Tables(0).TableName
DataGridView1.DataSource = myBindingSource

Catch ex As Exception
objCmd.Connection.Dispose()
objConn.Close()
MessageBox.Show("Exception: {0}", ex.ToString())
End Try
objConn.Close()
End Using

Catch ex As Exception
MsgBox(Err.Description, MsgBoxStyle.Information, "LoadData")
End Try

End Sub

Public Function CreateConnection() As String
gsServerNameFromRes = gsServerNameFromRes
gsUserIDFromRes = gsUserIDFromRes
gsPasswordFromRes = gsPasswordFromRes

gsServerNameFromRes = "MyTNSName"
gsUserIDFromRes = "MyUserID"
gsPasswordFromRes = "MyPassword" '

gsCnnString = "Data Source=" & gsServerNameFromRes & _
";User Id=" & gsUserIDFromRes & _
";Password=" & gsPasswordFromRes

Return gsCnnString
End Function

Private Sub btnFilter_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnFilter.Click
Dim sFilter As String = TextBox1.Text
myBindingSource.Filter = "FIRSTNAME = '" & sFilter & "'" End Sub
End Class

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.