Drop the loop. Use a Button instead. Label it "Add". On a user's click on your AddButton, copy the current values of your input fields to the ListBox. Then clear the input fields and set focus on the first one.
That way, users can type in names and click on the AddButton as often as they want.
If you want to restrict the number of rows added to the ListBox, then you can implement that in your AddButton_Click method, too.
The way I see it you have 3 options: use the "Add" button sugestion, the gridview one, or make the user input a separating character between values, so you can take the inputs, split the strings by that character and work with the results.
I think the best one, for the average end user, would be the Add button, having more than 1 "value" in the textbox is not very efficient or comfortable.
Hi all, I am trying to change the name of each file as it's being downloaded. The following are what I have done thus far:
I have uploaded files to a folder on the web server but replace their names with GUIDs to prevent problems that could arise later on due to duplication . Their original names have been saved to a database and so are their extensions and the paths to their new location on the web server. The problem I am facing now is giving them their original names back when they are downloaded.
I know I have to replace the GUID with their original names and original extension when they are being downloaded. I have looked at using Response.AddHeader() method but I am not quite sure on how to make it work. Suppose a file in a folder on the web server have the GUID 123-GtR-XYZ as its name and suppose its original name was test.doc. How do I replace the GUID with the file's original name while it is being downloaded? The following is the method I currently use to retrieve a file from the folder on the web server.
//Creating a datatable
DataTable Dtable = new DataTable("INFO");
//Adding a column of type string name URL
//putting files in an array of type string
string fileEntries = Directory.GetFiles(Server.MapPath("~/Uploads/"));
//int linkL = 0;foreach (string fileName in fileEntries)
Dtable.Rows.Add("~/Uploads/" + Path.GetFileName(fileName));
myGrid.DataSource = Dtable;
Let's say that I have written a SQL query to retrieve the original file name and original extension of the file being downloaded and now we have the GUID, the original file name, and original extension. How do I make use of those data to give each downloaded file it's original name back? Please give a code snippet or point me to a good tutorial if you can. Thank you in advance for your help.
I have previous experience using WinForms and the DataGridView control. I am trying to re-code a previous program using WPF that reads a parts list from a delimited text file and displays results in a DataGrid control.
In WinForms, I was able to assign a tag to the DataGrid row that I used to link individual URLs to our company's HTML-based inventory program. However, I am unsure how to do this (if it's even possible) in WPF. Currently, I read from the text file and load its contents into a List. From there, I filter the List by whatever the user selects, then display the results in a DataGrid control. I want to open up the browser when the user selects a row, but can't figure out how to bind the URL to the row. Is this possible? If so, can someone help point me in the right direction?
I have a C# 2010 console application calling a second console application. I want the main calling console application to wait for the e_Process1 console application to quit running before the second console application is called with different parameter.
I want the main calling console application to look at values in a sql server 2008 database before calling the second console application with different parameters.
When you look at the 2 lines of code listed below, you will see that the main console program is watiting for the second console application to run. However the main console application is stilling waiting.
Code referecing to:
Thus can you tell me what you suggest I do to solve my problem? Either the second console application never quits executing and/or I need to use diferent statements.
Thus can you tell me what you suggest I do to solve my problem?
Sounds like the first application is doing exactly what you want it to do. You should be investigating why the second application never exits.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
Maybe the "second console" application never stops running? Is there a way that I can tell if the "second console" application ever stops running? If so, how can I tell when the "second console" application has finished executing?
Basically the second console application calls a web service to obtain information. The "second" console application has a proxy in it to communicate with the web service.
There is an 'xsd' file that communicates with the web services via xml. Do proxies always keep running?
You should forget about using Process.Start for the moment and make sure that you understand how the second application behaves when run manually in a command window.
Hopefully after typing in the correct command line, the application will run and then exit. If the running application requires user interaction, e.g. "Press a key to exit", then it may be a poor candidate for automation via Process.Start.
If the manual run is ok can you post the code used to initialise the Process object.
I want to make the following comments:
1. When I stepped through the code using a visual studio.net 2008 debugger, the application did finish executing when the main procedure finished executing. Basically there was no where for me to step through the code again.
However the debugger was still active and ready to continue debugging.
Does this the application is still executing?
2. As far as I can tell, the application runs fine from the dos window. It does not ask me to enter any information. Does that mean it has finished executing?