Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 19th, 2007, 08:37 AM
Registered User
 
Join Date: Dec 2006
Location: Tucson, Az, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid display

I have 2 buttons, Button A for list all employees.Button B for search employee by last name. Result is displayed in a datagrid.
Button A works when program starts and fills the datagrid with list of all employees. Button B works while data grid is displaying list of all employees, and changes the display with employees with same lastname. But after I have used button B Button, A do not work or say datagrid do not display list of all employees here is the code for Button A

        dgdEmpSearch.Visible = True
        DsEmployees1.Clear()
        daEmployees.Fill(DsEmployees1)
        dgdEmpSearch.Refresh()
Do I need to clear the datagrid before "daEmployees.Fill(DsEmployees1)" then I do not know the command to do it. Please give the command syntex too.





js
__________________
js
Reply With Quote
  #2 (permalink)  
Old January 20th, 2007, 05:12 PM
Registered User
 
Join Date: Dec 2006
Location: Tucson, Az, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I solved the problem and i am givving the solution for the benefit of people like me. First let me explain what is happeniong here:
To search by name is done then a command is executed. Command sysntex is daYouradopter.selectcommand.commandtext="Select * from table where empname="searchname"
now this command is forcing when button A to list all employees is clicked and display never changes. therefore i had to give daYouradopter.selectcommand.commandtext="Select * from table and now i can display all entires from the table. Here is the actual code
        dgdempSearch.Visible = True
        Dsemployee1.Clear()
        dgdempSearch.Refresh()
        daemployees.SelectCommand.CommandText = "Select * From tblemployees"
        daemployees.Fill(DsCustomers1)


js
Reply With Quote
Reply


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
datagrid does not display next page vhrao ASP.NET 2.0 Basics 9 July 22nd, 2007 01:28 AM
Display Image in Datagrid annie_stwg ASP.NET 1.0 and 1.1 Basics 2 March 15th, 2006 03:57 PM
Datagrid display deadrocker .NET Web Services 1 February 12th, 2005 07:04 AM
How to display checkbox in a DataGrid kmazumdar ADO.NET 2 August 23rd, 2004 04:35 PM
Datagrid for display images sam.johnston@jtisys.com ASP.NET 1.x and 2.0 Application Design 1 January 18th, 2004 03:04 PM



All times are GMT -4. The time now is 10:20 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.