11/1/2023 0 Comments Another word for what![]() ![]() If (form.ValueAuthentication = "SQL Server Authentication") PopUpDatabase form = new PopUpDatabase() And when the messagebox open, application stop during you click any button in related messagebox. I created my messagebox for getting database information like below. _btnCancel.DialogResult = DialogResult.Cancel įormBorderStyle = FormBorderStyle.FixedDialog _lblPrompt.BackColor = Color.Transparent _btnCancel.Location = new Point(114, 60 + promptHeight) _btnOk.Location = new Point(8, 60 + promptHeight) _txtInput.Size = new Size(inputWidth, 21) Int inputWidth = promptWidth < 206 ? 206 : promptWidth _txtInput.Location = new Point(8, 30 + promptHeight) _lblPrompt.Size = graphics.MeasureString(prompt, _lblPrompt.Font).ToSize() If (title = null) title = Application.ProductName Location = new Point(xPos.Value, yPos.Value) StartPosition = FormStartPosition.Manual StartPosition = FormStartPosition.CenterParent Public InputBoxDialog(string prompt, string title, string defaultValue = null, int? xPos = null, int? yPos = null) InputBoxDialog form = new InputBoxDialog(prompt, title, defaultValue, xPos, yPos) Public static string ShowDialog(string prompt, string title, string defaultValue = null, int? xPos = null, int? yPos = null) The public method creates a dialog and returns the user's input, or null if they cancel. ![]() Here's my code it auto-centers and sizes to fit the prompt. Do some validation for the text in txtInput to be sure the ip is well-formated. ![]() Private void btnInput_Click(object sender, EventArgs e) In your Input form, add a property: public class Input : Form private void btnAddServer_Click(object sender, EventArgs e) Create a property in SetIPAddressForm to return the input of user.Įdit: Add another example to fit with manemawanna comment. Using(SetIPAddressForm form = new SetIPAddressForm()) Private void OnAddIPAddressClicked(object sender, EventArgs e) In the event handler, do something similar as the code below: private string m_ipAddress In your main form, add an event handler for the event Click of button Add Ip Address. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |