Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 1st, 2006, 12:47 PM
Authorized User
 
Join Date: Aug 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default Advancing through a bound control

Hey Guys,

I have a textbox bound to a datatable. Here is the syntax:

Me.txt_1.DataBindings.Add("Text", table, table.Columns(0).ColumnName)
Controls.Add(Me.txt_1)

The value of the first record appears in the textbox just fine. I want to build a button on the screen to advance through the DataTable and get to the next record. How do I go about doing this?

Ryan


nikotromus
__________________
nikotromus
 
Old March 19th, 2006, 04:36 AM
Authorized User
 
Join Date: Mar 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have just done a simple program in my tutorials that does this on a button_Click event...Here is my piece of code that I used...Hope it is of use. You'll have to rearange the variables though. xxx

Private Sub btnNext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNext.Click
        BindingContext(DsStockList1, "stocklist").Position = _
              BindingContext(DsStockList1, "stocklist").Position + 1

 'This will step you 1 by 1 through the dataset
    End Sub

    Private Sub btnPrevious_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrevious.Click
        BindingContext(DsStockList1, "stocklist").Position = _
                   BindingContext(DsStockList1, "stocklist").Position - 1
   'This will take you back step by step
    End Sub






Similar Threads
Thread Thread Starter Forum Replies Last Post
Bound Vs Unbound controls Richard_AU ADO.NET 1 January 16th, 2007 01:40 PM
Bound Controls cpanson ADO.NET 0 June 24th, 2006 07:29 PM
Need help with bound data kcrompt2 Classic ASP Professional 0 February 9th, 2005 12:37 AM
bound DTPicker control-urgent myth12345 VB Databases Basics 0 December 31st, 2004 06:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.