CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2013
    Posts
    1

    combobox to 'show all' when checkbox is true

    I have this code in place where a combobox will show 'Codes' where codes = 'Y' and status = 'A' from a database. There is a checkbox that says 'show all' and when it is checked, it should show all codes where the status = 'A' and not matter if the code is 'Y'. (some codes = 'N') But it is not working. Can anyone see why it is not working? This is the only code i have in place for this checkbox.


    Code:
                    if (Combobox.Checked == true)
                    {
                        Datatable= Main.SQLQuery_ReturnDS("Select Code Display, 2 from Code_Support where Status = 'A' Union All Select '', 1 ORDER BY Code").Tables[0];
                        DataColumn[] CodekeyColumn = new DataColumn[1];
                        CodekeyColumn[0] = Datatable.Columns[0];
                        Code.DataSource = Datatable;
                        Code.DisplayMember = "Display";
                        Code.ValueMember = "Display";
                    }
                    else
                    {
                        Datatable= Main.SQLQuery_ReturnDS("Select Code Display, 2 from Code_Support where Code = 'Y' and Status = 'A' Union All Select '', 1 ORDER BY DOSCode").Tables[0];
                        DataColumn[] CodekeyColumn = new DataColumn[1];
                       CodekeyColumn[0] = Datatable.Columns[0];
                        Code.DataSource = Datatable;
                        Code.DisplayMember = "Display";
                        Code.ValueMember = "Display";
    
                    }

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: combobox to 'show all' when checkbox is true

    How does this code get called?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured