Wrox Programmer Forums
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 January 19th, 2007, 08:37 AM
Registered User
Join Date: Dec 2006
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
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.

Old January 20th, 2007, 05:12 PM
Registered User
Join Date: Dec 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts

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
        daemployees.SelectCommand.CommandText = "Select * From tblemployees"


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 12: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 03: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

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