C# noob.

Ok, here's what I'm trying to do ...

I have a dbUtilities class I've made. And its my desire to have methods in it like "FillListBoxFromDB" .... I want to pass the listBox that will be the target, and the sql query command.

I will have multiple places I want to fill listboxes, combo boxes, etc ... so I just want to create one generic utility method I can call.

I tried:

public void FillListBoxFromDB(ByRef listBox AS lb, string sqlCommand)

But that generates 9 build errors concerning tokens and arrays.

I changed it to:

public void FillListBoxFromDB(listBox ls, string sqlCommand)

and I get only one error:

error CS0246: The type or namespace name 'listBox' could not be found (are you missing a using directive or an assembly reference?)

Even though I have using System.Windows.Forms;

Any help would be appreciated. :)

Recommended Answers

All 2 Replies

public void FillListBoxFromDB(listBox ls, string sqlCommand)

There is no any Class listBox .Letter L should be capital for Class ' ListBox'
in namespace System.Windows.Forms;

There is no any Class listBox .Letter L should be capital for Class ' ListBox'
in namespace System.Windows.Forms;

That fixed it! Sooooo frustrating.

Thanks K.D.M.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.