Click here to Skip to main content
15,890,579 members
Home / Discussions / C#
   

C#

 
AnswerRe: Securing a web method Pin
SarahMcM1-Jun-10 20:36
SarahMcM1-Jun-10 20:36 
GeneralRe: Securing a web method Pin
KaurGurpreet1-Jun-10 21:20
KaurGurpreet1-Jun-10 21:20 
GeneralRe: Securing a web method Pin
SarahMcM2-Jun-10 11:46
SarahMcM2-Jun-10 11:46 
QuestionMessage Removed Pin
1-Jun-10 18:22
amaankhan1-Jun-10 18:22 
AnswerRe: help Pin
Mycroft Holmes1-Jun-10 19:34
professionalMycroft Holmes1-Jun-10 19:34 
GeneralRe: help Pin
amaankhan1-Jun-10 19:46
amaankhan1-Jun-10 19:46 
AnswerRe: help Pin
Abhinav S1-Jun-10 19:35
Abhinav S1-Jun-10 19:35 
QuestionRemove Item from listbox Pin
future38391-Jun-10 17:55
future38391-Jun-10 17:55 
Hi ever1,

I have listBox and via coding add sth to it. I would like after I add item it select.
I eana this approach for delete and undo an item from list box.


string[] Field = new string[9];//defining array
       private string SaveDataBeforDel(string Fr_Name, string Sr_Name, string St_Id, double Lb_Mark, double Ass1, double Ass2, double Fnl, double TotalMark, string Grade)
       {
           Field[0] = Fr_Name;
           Field[1] = Sr_Name;
           Field[2] = St_Id;
           Field[3] = Convert.ToString(Lb_Mark);
           Field[4] = Convert.ToString(Ass1);
           Field[5] = Convert.ToString(Ass2);
           Field[6] = Convert.ToString(Fnl);
           Field[7] = Convert.ToString(TotalMark);
           Field[8] = Grade;

           CleabTxtBox();
           return string.Empty;
       }





private void LstBox_SelectedIndexChanged_1(object sender, EventArgs e)
       {
           if (LstBox.SelectedIndex != -1)
           {
               ITECH3219Student s = (ITECH3219Student)LstBox.SelectedItem;
               Assigningdata_Totextbox(s.Fr_name.ToString(), s.Sr_Name.ToString(), s.St_Id.ToString(), s.Lb_Mark, s.Ass1, s.Ass2, s.Fnl, s.TotalMarkCalculation(),s.Grade.ToString());
           }

       }









private void Btn_Del_Click(object sender, EventArgs e)
       {
           Btn_Del.Enabled = false;
           Btn_undo.Enabled = true;

           SaveDataBeforDel(Txt_name.Text, Txt_surname.Text, Txt_Id.Text,Convert.ToDouble(Txt_lbmark.Text), Convert.ToDouble(Txt_ass1.Text), Convert.ToDouble(Txt_ass2.Text), Convert.ToDouble(Txt_final.Text),Convert.ToDouble(Txt_total.Text), Txt_grade.Text);
           LstBox.Items.RemoveAt(LstBox.SelectedIndex);
       }








private void Btn_undo_Click(object sender, EventArgs e)
        {
            Btn_Del.Enabled = true;
            Btn_undo.Enabled = false;

            Student_Manipulation s = new Student_Manipulation();
            LstBox.Items.Add(s.AddStudent_Tolist(Field[0], Field[1], Field[2]));

            Txt_lbmark.Text = Field[3];
            Txt_ass1.Text = Field[4];
            Txt_ass2.Text = Field[5];
            Txt_final.Text = Field[6];
            Txt_total.Text = Field[7];
            Txt_grade.Text = Field[8];

            ITECH3219Student s1 = (ITECH3219Student)LstBox.SelectedItem;
            Assigningdata_Totextbox(Field[0], Field[1], Field[2], Convert.ToDouble(Field[3]), Convert.ToDouble(Field[4]), Convert.ToDouble(Field[5]), Convert.ToDouble(Field[6]), Convert.ToDouble(Field[7]), Field[8]);                



Do u have any idea how can I remove an item from list box. then undo that. aftyer undo that item select.
thx in advance
Questionexe not executed Pin
prithaa1-Jun-10 17:44
prithaa1-Jun-10 17:44 
AnswerRe: exe not executed Pin
AspDotNetDev1-Jun-10 17:50
protectorAspDotNetDev1-Jun-10 17:50 
AnswerRe: exe not executed Pin
amaankhan1-Jun-10 18:09
amaankhan1-Jun-10 18:09 
GeneralRe: exe not executed Pin
prithaa1-Jun-10 19:02
prithaa1-Jun-10 19:02 
GeneralRe: exe not executed Pin
amaankhan1-Jun-10 19:12
amaankhan1-Jun-10 19:12 
GeneralRe: exe not executed Pin
prithaa1-Jun-10 19:16
prithaa1-Jun-10 19:16 
AnswerRe: exe not executed Pin
Luc Pattyn2-Jun-10 1:53
sitebuilderLuc Pattyn2-Jun-10 1:53 
GeneralRe: exe not executed Pin
prithaa2-Jun-10 20:52
prithaa2-Jun-10 20:52 
GeneralRe: exe not executed Pin
Luc Pattyn3-Jun-10 1:36
sitebuilderLuc Pattyn3-Jun-10 1:36 
GeneralRe: exe not executed Pin
prithaa3-Jun-10 1:38
prithaa3-Jun-10 1:38 
GeneralRe: exe not executed Pin
Luc Pattyn3-Jun-10 1:40
sitebuilderLuc Pattyn3-Jun-10 1:40 
QuestionCalling COM fails in C# destructor Pin
cmartono1-Jun-10 16:41
cmartono1-Jun-10 16:41 
AnswerRe: Calling COM fails in C# destructor Pin
Abhinav S1-Jun-10 17:43
Abhinav S1-Jun-10 17:43 
QuestionClick on WindowPattern Pin
mayraglez1-Jun-10 7:41
mayraglez1-Jun-10 7:41 
QuestionDataTable row column lookup possiblity? Pin
Blubbo1-Jun-10 7:11
Blubbo1-Jun-10 7:11 
AnswerRe: DataTable row column lookup possiblity? Pin
T M Gray1-Jun-10 10:16
T M Gray1-Jun-10 10:16 
GeneralRe: DataTable row column lookup possiblity? Pin
Blubbo2-Jun-10 2:07
Blubbo2-Jun-10 2:07 

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.