c# - how to add arguments to button click that will only change part of cmd -
i'm trying build first c#
program , got stuck @ changing part of button click arguments.
i need ssid
, key
able changed:
strcmdtext = "/c netsh wlan set hostednetwork mode=allow ssid=changeme key=changeme keyusage=persistent & netsh wlan start hostednetwork";
here 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 wifion { public partial class form1 : form { public form1() { initializecomponent(); } private void button1_click(object sender, eventargs e) { string strcmdtext; strcmdtext = "/c netsh wlan set hostednetwork mode=allow ssid=changeme key=123123123 keyusage=persistent & netsh wlan start hostednetwork"; system.diagnostics.process.start("cmd.exe", strcmdtext); } private void button2_click(object sender, eventargs e) { string strcmdtext; strcmdtext = "/c netsh wlan stop hostednetwork"; system.diagnostics.process.start("cmd.exe", strcmdtext); } private void picturebox1_click(object sender, eventargs e) { messagebox.show("wifigo 1.0.\nwritten by: atilla eyice", "about"); } private void textbox1_textchanged(object sender, eventargs e) { } private void combobox1_selectedindexchanged(object sender, eventargs e) { } } }
string ssid = this.textbox1.text; string key = this.textbox2.text; strcmdtext = string.format("/c netsh wlan set hostednetwork mode=allow ssid={0} key={1} keyusage=persistent & netsh wlan start hostednetwork", ssid, key);
Comments
Post a Comment