i have written a class in which i have written methods to fill comboboxes. here is the code: - using System;
-
using System.Collections;
-
using System.Collections.Generic;
-
using System.IO ;
-
using System.Text;
-
using System.Windows.Forms;
-
using System.Data;
-
using System.Data.SqlClient;
-
-
-
namespace DALayer
-
{
-
class ClsFillControls
-
{
-
MasterData md = new MasterData();
-
public SqlDataReader sqlDR ;
-
-
public void DisplayGrid(ref DataGridView dgGrid, string sSql )
-
{
-
try
-
{
-
dgGrid.DataSource =md.ReturnDataTable ( sSql );
-
}
-
catch ( Exception ex )
-
{
-
throw ex;
-
}
-
}
-
-
public void FillCombobox( ref ComboBox cmbBox, string sSql )
-
{
-
try
-
{
-
sqlDR = md.ExecReader( sSql );
-
-
cmbBox.Items.Clear();
-
while (sqlDR.Read())
-
{
-
cmbBox.DataSource = sqlDR;
-
}
-
-
sqlDR.Close();
-
-
}
-
catch ( Exception ex )
-
{
-
throw ex;
-
}
-
}
-
-
public void FillMultiComboBox( ref ComboBox cmbBox1, ref ComboBox cmbBox2, string sSql )
-
{
-
try
-
{
-
//SqlDataReader sqlDR = new SqlDataReader();
-
sqlDR =md.ExecReader( sSql );
-
cmbBox1.Items.Clear();
-
cmbBox2.Items.Clear();
-
while ( sqlDR.Read() )
-
{
-
cmbBox1.Items.Add( sqlDR(0) );
-
cmbBox2.Items.Add( sqlDR );
-
}
-
sqlDR.Close();
-
-
}
-
catch ( Exception ex )
-
{
-
throw ex;
-
}
-
}
-
-
public void FillComboBox( ref DataGridViewComboBoxColumn cmbBox, string sSql )
-
{
-
try
-
{
-
//SqlDataReader sqlDR;
-
sqlDR = md.ExecReader( sSql );
-
cmbBox.Items.Clear();
-
while ( sqlDR.Read() )
-
{
-
cmbBox.Items.Add( sqlDR ) ;
-
}
-
}
-
catch ( Exception ex )
-
{
-
throw ex;
-
}
-
-
}
-
}
-
}
Please let me know where is the error
thank u
0 1028 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Perttu Pulkkinen |
last post by:
Hi all php freaks!
Do you think this kind of "property class" is useful or not? I have bee
bored to the way I've been coding earlier. because:
- often i have database-oriented classes like product, category, news etc.
- often i have fex. load, request, insert, update and delete functions for
them
- often problems are the same ones:
- which member variables are expected from the form, which ones are not
|
by: Wael |
last post by:
Hi,
I created a custom control, but I can't add an item property to it. I
tried the code below, but when I click the property, it shows a list of
Objects. I can't figure out how to have items to hold only integers.
Even with Objects, they seem to be readonly. I can't assign values to
them.
<Bindable(True), Category("Data"), DefaultValue("Item")> Property
() As ArrayList
|
by: Andrew Chen |
last post by:
Hi:
I've tried to use Hashtable.Item property, which should
return a value according to the key assigned. But it
returns an error saying the function does not exist in the
class (it did not show up under intellisense either when I
typed in the letter). Can someone tell me if this is a
bug and how do I fix that?
Andrew
|
by: Dotnetjunky |
last post by:
Hi,
I'm really get confused on this issue. Hope that someone can help me get
clear after this post.
Take the class System.Web.Caching.Cache for example. In the documentation,
there's a property called Item and the description is:
"Gets or sets the cache item at the specified key. In C#, this property is
the indexer for the Cache class."
|
by: Wamiq Ansari |
last post by:
Hi!,
I am trying to add a value to a StringDictionary using its Item Property in
C#. However this throws an expection as follows:
Cannot implicitly convert type 'Component.TemplateComponent' to 'string'.
The method I am using is as follows:
private StringDictionary componentList = new StringDictionary();
public void addComponent(TemplateComponent docComponent)
| |
by: Marc van den Bogaard |
last post by:
hello together,
my datarow.item property is missing, i just can accesss the ItemArray
property,
what is wrong with this?
System.Data.DataSet dataset1 = new System.Data.DataSet();
System.Data.DataTable datatable1 = new System.Data.DataTable("table1");
|
by: Andrés Giraldo |
last post by:
Hi!
I'm trying to creat a custom TabStrip Control, everything's ok but I
want that in design time the developer creates each tab of the items
property by a designer on the property tool box.
I didn't ever work with designers, but I think it's no necesary to
create one in this case, the Items property what I'm talkin is a item
colleccion class that inherits from System.Collections.CollectionBase,
so i just declare Items property as...
|
by: Earl |
last post by:
Noting first that I'm coming from VS2003 and VB.Net ...
Using an untyped dataset, I create a dataview. When I try to use the Item
property, "Item" does not appear on the Intellisense dropdown and I also get
the build error "'System.Data.DataView' does not containt a definition for
'Item'." The documentation for VS2005 does show Item as a property of a
dataview -- can anyone see the issue?
DataView dvContacts = new DataView(ds.Tables);...
|
by: lithoman |
last post by:
I'm stumped here. I run the procedure Batch_Select against the database
with @ID=18 and I get the expected data.
When it loads into a SqlDataReader, it gets messed up somehow.
Initially, after the reader.Read(), it has a row with 13 data columns,
but they're all empty. So, my GetInt() function throws an error. When
it jumps to the catch(), reader's columns then show the proper data.
What gives?
I have reader._data (which is the ID...
|
by: mousumi123 |
last post by:
Hello,
http://www.jroller.com/djspiewak/entry/properties_files_in_ruby
From this link i came to know that there is some Property class in ruby.
So, i tried using it like this
props=Properties.new
props.load 'file.properties'
But while running it is giving me NameError for Properties.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |