Hack Forums
[C#] Pasting from clipboard into multiple textboxes - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] Pasting from clipboard into multiple textboxes (/showthread.php?tid=6215150)



Pasting from clipboard into multiple textboxes - john ronaldsad - Jul 27, 2022

As the thread subject says. I'm looking to paste a string of characters and numbers into multiple textboxes and get rid of any dashes (-) in the process of pasting into said textboxes. I'm not sure what to even start with in the code.

anyways an example is like this

you copy the string below
DSGF-234S-DR3f-S3R5

and you paste it into multiple textboxes (with the underlines representing the actual textboxes)

DSGF - 23GF - DR3F - S3R5

Any and all help is much appreciated!


RE: Pasting from clipboard into multiple textboxes - Fudster - Jul 27, 2022

You could paste the string individually?


RE: Pasting from clipboard into multiple textboxes - HFDone - Jul 28, 2022

string[] text = Clipboard.GetText().Split('-');
textBox1.Text = text[0];
textBox2.Text = text[1];
...


RE: Pasting from clipboard into multiple textboxes - john ronaldsad - Jul 28, 2022

(Jul 28, 2022 02:29 AM)HFDone Wrote:  string[] text = Clipboard.GetText().Split('-');
textBox1.Text = text[0];
textBox2.Text = text[1];
...

awesome! This works! Thank you much!