Posílám ukázku kódu - program(1), který otevírá program(2) s argumentem. Tento argument má být text:
Program1:
- Kód: Vybrat vše
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 Otevri_Jiny_EXE
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btn_Otevri_Click(object sender, EventArgs e)
{
Spustit2();
}
private void Spustit2()
{
ProcessStartInfo startInfo = new ProcessStartInfo("C:\\Ahoj_Svete.exe");
//ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Minimized;
startInfo.Arguments = "Předávaný text";
Process.Start(startInfo);
}
}
}
A zde je program(2), u kterého nevím co udělat, aby mi přijal argument a pracoval jsem s ním.
Program(2):
- Kód: Vybrat vše
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;
namespace Ahoj_Svete
{
public partial class Form1 : Form
{
string predany_Text;
public Form1()
{
InitializeComponent();
label1.Text = predany_Text;
}
}
}
Tento argument chci předat do label1.
Poraďte díky.