Textbox into Label [closed]

Here label1 is a Label That you placed in the UI, And you are trying to assign a string value to that control. Such assignment is not valid and not permitted. Your requirement is to assign alPos as the Text property of the Label Control. So your query should be like the following: label1.Text = … Read more

CMD command on c#

I believe what you want is this: Process p = new Process(); ProcessStartInfo psi = new ProcessStartInfo(“cmd.exe”); // add /C for command, a space, then command psi.Arguments = “/C dir”; p.StartInfo = psi; p.Start(); The above code allows you to execute the commands directly in the cmd.exe instance. For example, to launch command prompt and … Read more

How to get all images from a url to picturebox in c#?

Just create picture box at runtime on form load like this. And you have to only increament x and y value after every cycle private void Form1_Load(object sender, EventArgs e) { int x = 10, y = 10; string[] file = System.IO.Directory.GetFiles(@”C:\Users\Public\Pictures\Sample Pictures\”, “*.jpg”); PictureBox[] pb = new PictureBox[file.Length]; for (int i = 0; i … Read more

Run multiple winform instance sequentially

Maybe this can work: public static bool IsProgramRunning(string TitleOfYourForm) { bool result = false; Process[] processes = Process.GetProcesses(); foreach (Process p in processes) { if (p.MainWindowTitle.Contains(TitleOfYourForm)) { result = true; break; } } return result; } Call this function in the Main function(before opening the mainForm), if it is false Application.Exit() else show your form.. … Read more

Call the maximum from SQL table to textbox

You could design your database table using an IDENTITY column. The database will assign a next value for the inserted row. You can access the value using one of: SCOPE_IDENTITY, @@IDENTITY or IDENT_CURRENT. More can be found here: MSDN-Identity. To know the difference between SCOPE_IDENTITY and @@IDENTITY see here.

TextBox not containing "\r\n" strings

As I said in the comment, with Multiline=True and WordWrap=True, your textbox will display a long line as multilines (Wrapped)… but actually it is one single line, and that’s why your Lines.Length=1, try type in some line break yourself, and test it again. Or you can set WordWrap=False, and you will see there is only … Read more