.Hello guys! I would like to ask for some help regarding one of my class projects.

Here i have two classes named AddBook.cs and the other is ListCommand.cs, what i want to do is to transfer certain codes from AddBook to ListCommand so that whenever i want to use the codes i'm only going to call the class ListCommand to avoid writing the codes again.

Here are the codes that i want to store on ListCommand.cs:

SqlCommand comm1 = new SqlCommand("SELECT Authors_Name FROM Author", SQLcon.conn);
                        SqlDataAdapter da1 = new SqlDataAdapter(comm1);
                        DataSet ds1 = new DataSet();
                        checkedListBox1.DataSource = ds1.Tables[0];
                        checkedListBox1.DisplayMember = "Authors_Name";
                        checkedListBox1.ValueMember = "Authors_Name";

Thank you to those who can help!

6 Years
Discussion Span
Last Post by Geekitygeek

Are both of your classes forms? Is checkedListBox1 on AddBook form, and if so, is it that instance of checkedListBox1 you wish to rebind or do you have a second checkedListBox on the ListCommand class that you want to bind?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.