program running problem

hi, i have a problem with running my program. when i trace my codes, the program is able to run according to what i planned. but when i run without tracing, the program will skip 2 lines of codes. can anyone advise on what i can do thanx.



Answer this question

program running problem

  • Javahar

    hi,

    it works. thanx for your help. =;o)


  • Ben S

    below is my codes, my codes is to include check items in a checkedListBox and give it a name, then save it. the saved name will be displayed in a list in comboBox. the problems lies with the 2 lines whereby after saving the name, it should be selected and displayed in the comboBox, but it did not refresh the name list nor select the name.

    if(comboBox1.Text.Equals("New"))

    {

    name = txtName.Text;

    if(name == "Enter Name")

    {

    MessageBox.Show("Please enter name.","Save",MessageBoxButtons.OK);

    return;

    }

    else

    {

    Algorithm saveNewName = new Algorithm(name);

    //checking for duplicate names

    NameList = saveNewName.GetName(ref userNum);

    for(int i=0; i<userNum; i++)

    {

    if(NameListIdea == name)

    {

    MessageBox.Show("Name exists, please enter another name","Save Error",MessageBoxButtons.OK);

    return;

    }

    else

    saveNewName.SetName(name);

    }

    ID = saveNewName.AddNew();

    for(int i=0; i<newNameList.Length; i++)

    {

    //find algoID then add

    algoID = saveNewName.FindID(newNameListIdea);

    saveNewName.Add(ID, algoID);

    }

    getAlgo(); // line skipped, suppose to refresh the comboBox to update the new entry

    comboBox1.SelectedItem = name; // line skipped, suppose to show the selected name at the comboBox.

    txtName.Visible = false;

    txtName.Text = "Enter Name";

    }

    }


  • JagK

    hi, i've solved the problem by replacing the problematic line(method) by adding the contents of the methods into the codes. i believe the problem is due to another class declared in the method that clashes with the class declared in my codes. i have another problem which i need advise on, how can i trigger an event manually from a method. i have to trigger a button click event which consist of my "save file" codes. i understand that i can't simply call the event, like btnSave_Click() due to the parameters. can anyone help me with this thanx


  • Tailor

    Hi,

    Try to use button1.PerformClick();

    Thanks



  • Olga99

    Put the two lines, is anything related with the debug mode maybe are you using the Release build

    Regards.


  • Trophimus

    Hi,

    If you could be more specific, we can help you with the problems.

    Thank you



  • Ray Mordy

    If possible please put some part of your Code here..

  • program running problem