Wrox Programmer Forums
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 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 July 20th, 2006, 09:12 AM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using controls

I have 2 subroutine in my dataAccess class that basically populates dropdownbox and listbox.

I'm trying to cut this down to one instead of two, is it possible please?

Present code(s)
Public Overloads Sub FillDBControl(ByVal lb As ListBox, ByVal sql As String, ByVal value As String, ByVal text As String)
            lb.DataSource = ReturnDR(sql)
            lb.DataTextField = text
            lb.DataValueField = value
            lb.DataBind()
        End Sub

And the other
 Public Overloads Sub FillDBControl(ByVal ddl As DropDownList, ByVal sql As String, ByVal value As String, ByVal text As String)
            ddl.DataSource = ReturnDR(sql)
            ddl.DataTextField = text
            ddl.DataValueField = value
            ddl.DataBind()
        End Sub

What i'd like is to have just the one like so..

Public Sub FillDBControl(c as control, sql as string .....)

Any possibilities..

Using ASP.Net 2.0, VB

Thank you
Allen

 
Old July 31st, 2006, 05:01 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 140
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try This Kind pls do that in vb I am not good writhing Vb so i am giving u an c# example

fillControl(System.Web.UI.Control oControl,String sql)
{
  oControl.GetType().DataSorce();// ADD REST
}







Similar Threads
Thread Thread Starter Forum Replies Last Post
User controls' content: Chapter 2 User Controls AGS BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 10 July 26th, 2007 05:36 AM
Retain the value of Controls S_Dogra ASP.NET 1.0 and 1.1 Professional 1 January 31st, 2007 01:21 PM
Binding controls Boris Kofman VB Databases Basics 1 January 20th, 2007 01:16 PM
Controls dparsons VB.NET 2002/2003 Basics 1 October 19th, 2005 11:08 AM
Controls Natalie Beginning VB 6 6 September 12th, 2003 10:27 AM





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