Click here to Skip to main content
15,892,768 members
Home / Discussions / C#
   

C#

 
GeneralRe: Looping though Dataset Pin
kanchoette25-Feb-09 3:44
kanchoette25-Feb-09 3:44 
GeneralRe: Looping though Dataset Pin
ABitSmart25-Feb-09 4:10
ABitSmart25-Feb-09 4:10 
QuestionHow to add a ScrollBar where there is none? Pin
Megidolaon25-Feb-09 3:12
Megidolaon25-Feb-09 3:12 
AnswerRe: How to add a ScrollBar where there is none? Pin
Xmen Real 25-Feb-09 3:19
professional Xmen Real 25-Feb-09 3:19 
GeneralRe: How to add a ScrollBar where there is none? [modified] Pin
Megidolaon25-Feb-09 21:23
Megidolaon25-Feb-09 21:23 
GeneralRe: How to add a ScrollBar where there is none? Pin
Xmen Real 25-Feb-09 23:01
professional Xmen Real 25-Feb-09 23:01 
GeneralRe: How to add a ScrollBar where there is none? Pin
Megidolaon25-Feb-09 23:41
Megidolaon25-Feb-09 23:41 
GeneralRe: How to add a ScrollBar where there is none? Pin
Xmen Real 25-Feb-09 23:47
professional Xmen Real 25-Feb-09 23:47 
GeneralRe: How to add a ScrollBar where there is none? Pin
Megidolaon26-Feb-09 2:02
Megidolaon26-Feb-09 2:02 
GeneralRe: How to add a ScrollBar where there is none? Pin
Xmen Real 26-Feb-09 2:49
professional Xmen Real 26-Feb-09 2:49 
GeneralRe: How to add a ScrollBar where there is none? [modified] Pin
Megidolaon26-Feb-09 20:49
Megidolaon26-Feb-09 20:49 
GeneralRe: How to add a ScrollBar where there is none? Pin
Xmen Real 27-Feb-09 1:37
professional Xmen Real 27-Feb-09 1:37 
GeneralRe: How to add a ScrollBar where there is none? [modified] Pin
Megidolaon1-Mar-09 20:30
Megidolaon1-Mar-09 20:30 
GeneralRe: How to add a ScrollBar where there is none? Pin
Xmen Real 2-Mar-09 5:55
professional Xmen Real 2-Mar-09 5:55 
GeneralRe: How to add a ScrollBar where there is none? Pin
Megidolaon2-Mar-09 20:24
Megidolaon2-Mar-09 20:24 
AnswerRe: How to add a ScrollBar where there is none? Pin
Megidolaon6-Mar-09 1:11
Megidolaon6-Mar-09 1:11 
QuestionHow to Loop through this Arraylist Pin
Vimalsoft(Pty) Ltd25-Feb-09 3:03
professionalVimalsoft(Pty) Ltd25-Feb-09 3:03 
AnswerRe: How to Loop through this Arraylist Pin
Colin Angus Mackay25-Feb-09 3:14
Colin Angus Mackay25-Feb-09 3:14 
GeneralRe: How to Loop through this Arraylist Pin
Vimalsoft(Pty) Ltd25-Feb-09 3:29
professionalVimalsoft(Pty) Ltd25-Feb-09 3:29 
AnswerRe: How to Loop through this Arraylist Pin
PIEBALDconsult25-Feb-09 3:54
mvePIEBALDconsult25-Feb-09 3:54 
GeneralRe: How to Loop through this Arraylist Pin
Vimalsoft(Pty) Ltd25-Feb-09 4:05
professionalVimalsoft(Pty) Ltd25-Feb-09 4:05 
GeneralRe: How to Loop through this Arraylist Pin
PIEBALDconsult25-Feb-09 6:51
mvePIEBALDconsult25-Feb-09 6:51 
QuestionChallenge manipulating combobox selectedvalue and selectedvaluechanged Pin
highjo25-Feb-09 2:44
highjo25-Feb-09 2:44 
Hi!
i know people have asked a lot about comboboxes but it's not really about how to get the value or index or whatever.Let me explain.it's users access management application with users, roles and rights:
i have a form editRight with 2 combobox cmbUsers to list users and cmbroles to list role of each users and 3 listboxes.let's pause here

on load event i fill users combobox with users

 private void EditRight_Load(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
            //Load the user list in the dt_users dataset.dt_users and dt_roles are declare as global variables<br />
            dt_users = UserManager.FindAll().Tables[0];<br />
            //set the combobox cmbUsers datasource<br />
            cmbUsers.DataSource = dt_users.DefaultView;<br />
            //set display member and value member<br />
            cmbUsers.DisplayMember = "user_name";<br />
            cmbUsers.ValueMember = "user_id";<br />
<br />
                CallFillRoleCombo((int)cmbUsers.SelectedValue);<br />
            }<br />
            catch (System.Exception ex)<br />
            {<br />
                MessageBox.Show(ex.Message);<br />
            }<br />
        }<br />
<br />
        private void CallFillRoleCombo(int uid)<br />
        {<br />
            try<br />
            {<br />
                //load users roles into dt_roles database<br />
                dt_roles = UserRoleManager.FindByUser(uid).Tables[0];<br />
<br />
                //set combobox datasource<br />
                cmbroles.DataSource = dt_roles.DefaultView;<br />
                cmbroles.DisplayMember = dt_roles.Columns[2].ToString();<br />
                cmbroles.ValueMember = dt_roles.Columns[1].ToString();<br />
            }<br />
            catch (System.Exception ex)<br />
            {<br />
                MessageBox.Show(ex.Message);<br />
            }<br />
            <br />
        }<br />
<br />
        private void cmbUsers_SelectedValueChanged(object sender, EventArgs e)<br />
        {<br />
            CallFillRoleCombo((int)cmbUsers.SelectedValue);<br />
        }<br />


when i run the code its throws exception:Object reference not set to an instance of an object.It seems that its calling the cmbUsers_SelectedValueChanged eventhandler when setting the display member of the cmbUsers combobox.
How to work around it?Thank you for reading this.

eager to learn

AnswerRe: Challenge manipulating combobox selectedvalue and selectedvaluechanged Pin
Cracked-Down25-Feb-09 3:00
Cracked-Down25-Feb-09 3:00 
AnswerRe: Challenge manipulating combobox selectedvalue and selectedvaluechanged Pin
Xmen Real 25-Feb-09 3:14
professional Xmen Real 25-Feb-09 3:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.