Click here to Skip to main content
15,885,883 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: I can download file from listbox but I want it to save in specific folder in local... Pin
JHizzle5-Oct-15 0:41
JHizzle5-Oct-15 0:41 
QuestionI want to download file from list box. Could anyone help? Pin
Member 120161064-Oct-15 20:07
Member 120161064-Oct-15 20:07 
AnswerRe: I want to download file from list box. Could anyone help? Pin
Richard MacCutchan4-Oct-15 22:05
mveRichard MacCutchan4-Oct-15 22:05 
GeneralRe: I want to download file from list box. Could anyone help? Pin
Member 120161064-Oct-15 22:51
Member 120161064-Oct-15 22:51 
QuestionVS2015 - MVC - Getting a list of users for Admin Panel Pin
DeerBear3-Oct-15 2:05
DeerBear3-Oct-15 2:05 
Questionuse Ajax controls in handlebar template with HandelBar & Asp.net & Ajax Pin
mahadevkarekar2-Oct-15 1:22
mahadevkarekar2-Oct-15 1:22 
QuestionOpen files from listbox file listing in c# Pin
Member 120161061-Oct-15 17:26
Member 120161061-Oct-15 17:26 
AnswerRe: Open files from listbox file listing in c# Pin
Wendelius1-Oct-15 17:42
mentorWendelius1-Oct-15 17:42 
If I understand the question correctly, the problem is that you have placed the code that adds items into the listbox inside a SelectedIndexChanged event handler. So the code will only be run when an item from the list box is selected so if you have no items, the code is never run.

Try moving the code to a place which is executed when the listbox is shown. For example if this is Windows Forms, you can use load event:
C#
public Form1() {
   InitializeComponent();

   this.Load += Form1_Load;
}

private void Form1_Load(object sender, EventArgs e) {
  DirectoryInfo dinfo = new DirectoryInfo(@"C:\Users\Probing\Desktop");
  FileInfo[] Files = dinfo.GetFiles("*.txt");
  foreach (FileInfo file in Files)
  {
     ListBox1.Items.Add(file.Name);
  }
}

GeneralRe: Open files from listbox file listing in c# Pin
Member 120161061-Oct-15 17:58
Member 120161061-Oct-15 17:58 
GeneralRe: Open files from listbox file listing in c# Pin
Member 120161061-Oct-15 20:42
Member 120161061-Oct-15 20:42 
GeneralRe: Open files from listbox file listing in c# Pin
Wendelius1-Oct-15 21:02
mentorWendelius1-Oct-15 21:02 
GeneralRe: Open files from listbox file listing in c# Pin
Member 120161061-Oct-15 21:14
Member 120161061-Oct-15 21:14 
QuestionApp_GlobalResources and resx files, cannot find appropriate culture Pin
jkirkerx1-Oct-15 9:34
professionaljkirkerx1-Oct-15 9:34 
Answer[Solved] Re: App_GlobalResources and resx files, cannot find appropriate culture, masterpage Pin
jkirkerx1-Oct-15 13:50
professionaljkirkerx1-Oct-15 13:50 
Questionstart date end date not working Pin
Ekrem Tapan30-Sep-15 23:43
Ekrem Tapan30-Sep-15 23:43 
AnswerRe: start date end date not working Pin
Wendelius1-Oct-15 8:40
mentorWendelius1-Oct-15 8:40 
QuestionI wanted to upload Multiple Files With ListBox in ASP.NET Pin
Member 1201610630-Sep-15 16:33
Member 1201610630-Sep-15 16:33 
AnswerRe: I wanted to upload Multiple Files With ListBox in ASP.NET Pin
aarif moh shaikh1-Oct-15 0:29
professionalaarif moh shaikh1-Oct-15 0:29 
GeneralRe: I wanted to upload Multiple Files With ListBox in ASP.NET Pin
Member 120161061-Oct-15 17:12
Member 120161061-Oct-15 17:12 
GeneralRe: I wanted to upload Multiple Files With ListBox in ASP.NET Pin
Member 120161061-Oct-15 17:23
Member 120161061-Oct-15 17:23 
QuestionDisplay Image from MSSQL database into asp.net page using vb Pin
caffrey_130-Sep-15 4:52
caffrey_130-Sep-15 4:52 
AnswerRe: Display Image from MSSQL database into asp.net page using vb Pin
Wendelius30-Sep-15 5:01
mentorWendelius30-Sep-15 5:01 
GeneralRe: Display Image from MSSQL database into asp.net page using vb Pin
caffrey_130-Sep-15 5:18
caffrey_130-Sep-15 5:18 
GeneralRe: Display Image from MSSQL database into asp.net page using vb Pin
caffrey_130-Sep-15 20:48
caffrey_130-Sep-15 20:48 
GeneralRe: Display Image from MSSQL database into asp.net page using vb Pin
Wendelius1-Oct-15 8:34
mentorWendelius1-Oct-15 8:34 

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.