C# help please

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Dec 2008
Posts: 3
Reputation: mabshell is an unknown quantity at this point 
Solved Threads: 0
mabshell mabshell is offline Offline
Newbie Poster

C# help please

 
0
  #1
Dec 20th, 2008
Hello, I'm just starting in the world of C# and I'm stuck in a problem. I want to create a form with some textbox in it. It ask you the path of the exe file and some other information. When I run the program it tells me a Win32Exception: file cannot be found. I know that the path is correct. Even the arguments are not working. Thank you! Here is the code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace BF2_launch
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
Process process = new Process();
string path = Convert.ToString(textBox1);
string name = Convert.ToString(textBox2);
string pass = Convert.ToString(textBox3);
string ip = Convert.ToString(textBox4);
process.StartInfo.FileName = (path);
process.StartInfo.Arguments= " +restart +playerName "+name+ "+playerPassword "+pass;
process.Start();
}

private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,909
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 274
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: C# help please

 
0
  #2
Dec 20th, 2008
string path = Convert.ToString(textBox1);
Your path variable will contain the following : System.Windows.Forms.TextBox, Text:
to get the text out of a textbox use : textbox1.Text Correct and understand thisone first.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 3
Reputation: mabshell is an unknown quantity at this point 
Solved Threads: 0
mabshell mabshell is offline Offline
Newbie Poster

Re: C# help please

 
0
  #3
Dec 20th, 2008
Yes, that's why when I tested if it was capturing the string to show in a messagebox it showed a message and after that the string.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,909
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 274
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: C# help please

 
0
  #4
Dec 20th, 2008
capturing the string to show in a messagebox it showed a message and after that the string
Alright... and you where saying?
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 3
Reputation: mabshell is an unknown quantity at this point 
Solved Threads: 0
mabshell mabshell is offline Offline
Newbie Poster

Re: C# help please

 
0
  #5
Dec 20th, 2008
Made the changes that you posted and all works now. Thank you for you help and time I appreciate it.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,909
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 274
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: C# help please

 
0
  #6
Dec 20th, 2008
Mark this as solved.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC