troubleshooting Question

Attempting to create class for common mysql methods but can't create method that returns a combo box

Avatar of rturney
rturneyFlag for United States of America asked on
.NET Programming
4 Comments1 Solution204 ViewsLast Modified:
I am learning C# and am struggling with classes.  I have a C# program that uses MySQL methods residing in Form1.  Another form, Form2, must share these methods.  I added a new class, MyClass, to hold these common methods.  I declare them as:

 public static string method1()  // because all the methods return a string value.

My problem is that in a few cases I have a method that needs to return a ComboBox or a ListBox.  I already did this when the method was in Form1, but when I tried to move it to MyClass and set it up as:

public static ComboBox method2()

the ComboBox is not available as a possible return type in the pulldown list (as you type).  Neither is ListBox or ArrayList.   Array is available but I'm not sure how to use it.  The ComboBox and ListBox return types were very convenient to return a list.  I could use ArrayList.  I haven't tried a string array because of the difficulty in declaring its size before knowing how many items will be returned.

The method is supposed to return a list of items that satisfy the given MySQL query.  

Thanks,
-Bob


ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros