Click here to Skip to main content
15,889,527 members
Home / Discussions / C#
   

C#

 
QuestionConvert System.Drawing.Image to System.Web.UI.WebControls.Image Pin
Add44-Jun-10 0:55
Add44-Jun-10 0:55 
AnswerRe: Convert System.Drawing.Image to System.Web.UI.WebControls.Image Pin
Hristo-Bojilov4-Jun-10 1:55
Hristo-Bojilov4-Jun-10 1:55 
QuestionHow to control a outer application? [modified] Pin
imbiz3-Jun-10 23:46
imbiz3-Jun-10 23:46 
AnswerRe: How to control a outer application? Pin
Luc Pattyn4-Jun-10 0:38
sitebuilderLuc Pattyn4-Jun-10 0:38 
GeneralRe: How to control a outer application? Pin
imbiz4-Jun-10 2:20
imbiz4-Jun-10 2:20 
GeneralRe: How to control a outer application? Pin
Luc Pattyn4-Jun-10 7:18
sitebuilderLuc Pattyn4-Jun-10 7:18 
GeneralRe: How to control a outer application? [modified] Pin
imbiz4-Jun-10 21:39
imbiz4-Jun-10 21:39 
Questionlistbox Pin
kennyhibs3-Jun-10 22:30
kennyhibs3-Jun-10 22:30 
Hi can anyone help with the following

i use filesystemwatcher to watch a folder and add a new entry into a listbox everytime a new file is created, there is a second listbox that duplicates whats in the first but with some code allows me to change the file name via a text box, works ok as long as the item in listbox2 is highlighted when i change text, however if the listbox updates while i'm in process of changing text it removes the highlight from the item i'm editing and crashes if i press enter to confirm new file name.

Ther error i get is no doubt due to it not knowing what index to change as none are highlighted.
So how can i get it to keep the file i am changing name of highlighted until i enter the new text.

private void fileSystemWatcher1_Created(object sender, System.IO.FileSystemEventArgs e)
       {
           listBox1.Items.Add(e.FullPath);
           listBox2.Items.Add(e.FullPath);
           listBox1.SelectedIndex = listBox1.Items.Count - 1;
           listBox1.SelectedIndex = -1;
           listBox2.SelectedIndex = listBox2.Items.Count - 1;
           listBox2.SelectedIndex = -1;
       }

       private void listBox1_Click(object sender, EventArgs e)
       {
           listBox2.SelectedIndex = listBox1.SelectedIndex;
       }

       private void listBox2_Click(object sender, EventArgs e)
       {
           int itemSelected = this.listBox2.SelectedIndex;
           string itemText = this.listBox2.Items[itemSelected].ToString();

           Rectangle r = this.listBox2.GetItemRectangle(itemSelected);
           this.textBox1.Location = new System.Drawing.Point(r.X + 217, r.Y + 520);
           this.textBox1.Size = new System.Drawing.Size(r.Width + 4, r.Height - 10);
           this.textBox1.Visible = true;
           this.textBox1.Text = itemText;
           this.textBox1.Focus();
           this.textBox1.SelectAll();
       }

       private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
       {
           if (e.KeyChar == 13)
           {
               this.listBox2.Items[this.listBox2.SelectedIndex] = this.textBox1.Text;

               this.textBox1.Visible = false;
           }
           if (e.KeyChar == 27)
               this.textBox1.Visible = false;
       }

AnswerRe: listbox Pin
Peace ON3-Jun-10 23:34
Peace ON3-Jun-10 23:34 
GeneralRe: listbox Pin
kennyhibs4-Jun-10 21:39
kennyhibs4-Jun-10 21:39 
Questionwant to change theme of controls..... Pin
jainiraj3-Jun-10 19:54
jainiraj3-Jun-10 19:54 
AnswerRe: want to change theme of controls..... Pin
Johnny J.3-Jun-10 21:16
professionalJohnny J.3-Jun-10 21:16 
AnswerRe: want to change theme of controls..... Pin
Abhinav S3-Jun-10 21:31
Abhinav S3-Jun-10 21:31 
GeneralRe: want to change theme of controls..... Pin
Johnny J.3-Jun-10 22:11
professionalJohnny J.3-Jun-10 22:11 
AnswerRe: want to change theme of controls..... Pin
Dave Kreskowiak4-Jun-10 1:45
mveDave Kreskowiak4-Jun-10 1:45 
GeneralRe: want to change theme of controls..... Pin
Johnny J.4-Jun-10 2:25
professionalJohnny J.4-Jun-10 2:25 
GeneralRe: want to change theme of controls..... Pin
Dave Kreskowiak4-Jun-10 4:36
mveDave Kreskowiak4-Jun-10 4:36 
QuestionHow to Create DB in SQL server Pin
Joe Rozario3-Jun-10 18:05
Joe Rozario3-Jun-10 18:05 
AnswerRe: How to Create DB in SQL server Pin
dan!sh 3-Jun-10 18:26
professional dan!sh 3-Jun-10 18:26 
GeneralRe: How to Create DB in SQL server Pin
Joe Rozario4-Jun-10 0:14
Joe Rozario4-Jun-10 0:14 
AnswerRe: How to Create DB in SQL server Pin
Gonzalo Cao4-Jun-10 3:29
Gonzalo Cao4-Jun-10 3:29 
QuestionDisparity between value semantics behavior with List< struct > vs. array of struct Pin
Stache3-Jun-10 15:07
Stache3-Jun-10 15:07 
AnswerRe: Disparity between value semantics behavior with List vs. array of struct [modified] PinPopular
Anthony Mushrow3-Jun-10 17:19
professionalAnthony Mushrow3-Jun-10 17:19 
GeneralRe: Disparity between value semantics behavior with List vs. array of struct Pin
Stache4-Jun-10 4:23
Stache4-Jun-10 4:23 
QuestionEnglish wordlist database for word processing app?? Pin
Jaison V3-Jun-10 7:57
Jaison V3-Jun-10 7:57 

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.