TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Zakir Ahamed
NA
1.4k
630.7k
i need to check Multicheckedlistbox with checked items
Jul 21 2017 7:20 AM
hi friends,
i am developing winforms i have issue:
this is my code:
private void GvCategory_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
try
{
indexRow = e.RowIndex;
DataGridViewRow row = GvCategory.Rows[indexRow];
txtcategory.Text = row.Cells[1].Value.ToString();
//txtcategory.ReadOnly = true;
btncategory.Text = "Update";
rbyes.Checked = true;
if (txtcategory.Text != " ")
{
try
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RetailTestConnection"].ConnectionString);
con.Open();
string query = String.Format("Select [Item_Id]='{0}' order by Item_Id", Convert.ToInt32(txtcategory.Text));
SqlCommand cmd = new SqlCommand(query,con);
SqlDataReader dr = cmd.ExecuteReader();
string[] s = new string[] { };
while (dr.Read())
{
s = dr.ToString().Split(',');
}
int Length = s.Length;
for (int i = 0; i < Length; i++)
// for (int i = 0; i <= 1; i++)
{
string fetr = s[i];
for (int j = 0; j <= clbbrand.Items.Count - 1; j++)
{
if (clbbrand.Items[j].ToString() == s[i])
{
clbbrand.SetItemChecked(j, true);
break;
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
the list value is not geting , how i get the values to showed a checkbox saved and updated in time whatever values i saved i will showed in already i will cheked items..
i need immediate reply...
Reply
Answers (
5
)
my connection string is not working
Please convert VBA to c#.Actully it is in VBA MACRO