|
You can use Process.Start, and put the parameters on the command line, comma seperated. Of course, the app you're calling needs to expect them, in that order.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
For ex., if you use internet explorer with a parameter
System.Diagnostics.Process.Start("IExplore.exe","http://10.109.25.15/TouchScreen/Test/index.htm");
|
|
|
|
|
Hello,
You just have to set a " " (space) between the Text properties.
Like this:
procInfo.Arguments = tbA.Text + " " + tbB.Text + " " + tbC.Text;
Your Arguments would be:
[STAThread]
public static void Main(string [] Args)
{
if(Args.Length == 3)
{
}
for(int x=0;x<=Args.Length;x++)
{
}
}
All the best,
Martin
|
|
|
|
|
Thank you guys for your help!
|
|
|
|
|
Thanks again Martin!
I have the following code:
System.Diagnostics.Process proc; //Declare New Process
System.Diagnostics.ProcessStartInfo procInfo = new System.Diagnostics.ProcessStartInfo();
procInfo.WorkingDirectory = "C:\\dc\\bin"; //
procInfo.FileName = "scu.exe";
procInfo.Arguments = tb_params.Text + " " + tb_params1.Text + " " + tb_params2.Text + " ";
proc = System.Diagnostics.Process.Start(procInfo);
I have a Browse button which is the user will select its parameter for "tb_params2.Text".
Question - If I wanted to have more than one parameter display on "tb_params.Text" TextBox when the user select multiple parameters from the Browse Button. What Common Control Box do I need to display a multiple selection??
Thanks again for ur help.
|
|
|
|
|
Hello,
Just for info:
Eyungwah wrote: procInfo.Arguments = tb_params.Text + " " + tb_params1.Text + " " + tb_params2.Text + " ";
I think that you don't need '+ " ";' this.
But now to your question:
The TextBox would be able to show multiline text if you take care of properties like "Multiline"(true) and "AutoSize"(false). You would have to add a new line between your selected texts.
Like:
tb_params.Text = stringselection1 + System.Enviroment.NewLine + stringselection2;
Instead I would recommend the ListBox.
The "Items" property is what you need there.
Like:
lb_params.Items.Add(stringselection1);
So if you have a collection of selected parameters you would do:
for(int x=0;x<selectedparams.Length;x++)
{
lb_params.Items.Add(selectedparams[x]);
}
All the best,
Martin
|
|
|
|
|
Thanks again Mark for your replied.
I have a Browse button. If I created Four TextBox form. Everytime I Browse and select the file
it always show the same file on all of those four TextBox. Here's my code:
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
tb_params2.Text = dlg.FileName;
tb_params3.Text = dlg.FileName;
tb_params4.Text = dlg.FileName;
tb_params5.Text = dlg.FileName;
}
My goal is to have a Browse button that would navigate by a user and selected any file, then it displays that file on "tb_params2.Text" TextBox individually.
I have created four TextBox and I wanted the file that was selected throught the Browse displayed on the TextBox accordingingly.. Could you please help me how to do that?
Thanks
|
|
|
|
|
Hello,
Is it a question of multi selection?
In this case you should make your code dynamic and hold the references of your TextBoxes in a Hashtable.
private Hashtable AllTextBoxes = new Hashtable();
AllTextBoxes.Add(0, textBox1);
AllTextBoxes.Add(1, textBox2);
}
private void button2_Click(object sender, System.EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Multiline = true;
if (dlg.ShowDialog() == DialogResult.OK)
{
for(int x=0;x<AllTextBoxes.Count;x++)
{
TextBox actTB = AllTextBoxes[x] as TextBox;
if(x<dlg.FileNames.Length)
{
actTB.Text = dlg.FileNames[x];
}
else
{
actTB.Text = "";
}
}
}
}
If I didn't understand you right, please let me know.
All the best,
Martin
-- modified at 5:39 Thursday 1st February, 2007
|
|
|
|
|
I have windows application
when i log out from the application and login again
all values are pre filled in textboxes ans list boxes
i want that they get cleared when i logout
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
do i have to reset all the textboxes or is there also some other way to do it
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
I am doing like
txtbox1.clear();
textbox2.clear();
can i do it in one go with a single function for whole form
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
You can iterate over the controls collection and when you find textboxes or listboxes, clear them.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
can u give me sample code how will i do that
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
Hello,
Just use a foreach over your Controls Collection.
foreach(Control c in this.Controls)
{
Label actlabel = c as Label;
if(actlabel != null)
{
actlabel.Clear();
}
else
{
ListBox actlistbox = c as ListBox;
if(actlistbox != null)
actlistbox.Items.Clear();
}
}
All the best,
Martin
|
|
|
|
|
Hello,
I am getting a C# compiler warning for using Thread.Suspend() and Thread.Resume() methods:
Warning 6 'System.Threading.Thread.Suspend()' is obsolete:
'Thread.Suspend has been deprecated. Please use other classes in System.Threading,
such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect
resources. http://go.microsoft.com/fwlink/?linkid=14202'
I'm implementing these thread methods in a safe environment, when only a single worker thread accesses the resources. This worker thread is performing a lenghty calculation so I wanted to have an option to suspend/resume this CPU intensive and lenghty calculation.
Is there any other simple way to accomplish this task? Monitor, Mutex, Event nor Semaphore don't seem to be an effective replacement for Suspend() and Resume().
Thanks much,
Michal Kreslik
|
|
|
|
|
Thread.Sleep(Timeout.Infinite) should halt the thread. you can then interrupt it if you want it to start doing things again.
HTH
Russ
|
|
|
|
|
OK, thanks, but Sleep() is a static method, so it's not possible to call this method on any thread other than the current one, correct?
That means that it's not possible to put a thread to sleep externally this way. Is that true or am I missing something?
Thank you,
Michal Kreslik
|
|
|
|
|
i think the aim of the changes to the resume and suspend methods was that code that executes outside a thread doesn't know what resources the thread is using.
If for instance there was a database transaction open in the thread that you are putting to sleep you could create chaos for all users of the application not just the specific instance that the thread is running in.
I think the general plan is to check for the state of a variable somewhere in your code
while(_running)<br />
{DoStuff();}<br />
else<br />
{<br />
ReleaseExpensiveResources();<br />
Thread.Sleep(Timeout.Infinite);<br />
}
This way the thread won't suspend immedeately but it will suspend cleanly when it releases.
Russ
|
|
|
|
|
Hi
I m developing a web portal in c# asp.net web application .i want to built an email client.My email client will include the functionalty as
Making new account
sending e mail with attachments
receiving email with inbox maintaing facility. etc
but i have not any idea about it. Can any one guide us first of all about the email server that which server should b used 2ndly how it can be used n from where v can get help regading its builtin methods to b used in email client.
v want help in C# not in HTML codin
Thanx
|
|
|
|
|
Hi
I m developing a web portal in c# asp.net web application .i want to built an email client.My email client will include the functionalty as
Making new account
sending e mail with attachments
receiving email with inbox maintaing facility. etc
but i have not any idea about it. Can any one guide us first of all about the email server that which server should b used 2ndly how it can be used n from where v can get help regarding its builtin methods to b used in email client.
v want help in C# not in HTML coding
Thanx
Fakhraz
|
|
|
|
|
Get IIS Installed... install the SMTP Server... which comes with the windows cd... follow the instructions... make sure your server runs on 24/7 basis and it's a very good server.
get a free javascript text editor from the internet or better build one yourself.
use the Mail Class in C# for sending mails in attachment... research the internet...you can also use ajax for better user experience just like gmail does.
it won't take more than 2 months...
best of luck... and if you make it then please send me your url... i also would like to open a free email account....!
Regards,
Mahernoz
|
|
|
|
|
I have done that all but even after the configration settings which i m sure that i have done correctly i get the exception of CDO....... sort some thing
|
|
|
|
|
Hi,
I am facing some problem with the threads in my application. I changed the threading attribute from MTAThread to STAThread due to some reason and because of that I am facing an contextswitch deadlock exception after approx every 4 mins.
The Exception:
ContextSwitchDeadlock was detected
Message: The CLR has been unable to transition from COM context 0x159bc0 to COM context 0x1598e0 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
In few of the forums, people have said that there is no harm in disabling this exception in the following way -- "Simply uncheck the ContextSwitchDeadlock exception under Debug.Exceptions.Managed Debugging Assistants if you just want to ignore the exception in the debugger".
I want to know if there will be any performance issues or memory leakage of any sort. Will this affect my over all application in any way.
Please help me on this.
Thanks
KR
|
|
|
|
|
What i would do is compile the code as "Release" and run this from outside the Visual Studio Dev environment. If the problem is not present then you may simply ignore the exception.
|
|
|
|
|
My code is,
AxMSChart20Lib.AxMSChart chart = new AxMSChart20Lib.AxMSChart();
chart.Title.Text = "My first chart";
this.Controls.Add(chart);
When i use this code, i get this exception,
"InvalidActiveXSateException was unhandled"
Exception of type:
'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown.
Can u tell, how can this be corrected?
Thanks-Guna
|
|
|
|