84727

Creating an inputbox with radiobuttons c#

Question:

I'm currently making a simple C# game for a college assignment, wondering if it's possible to have radio or checkbox (or something similar) inputs upon loading, in an external window. I'm currently using this to get a username:

public Form1() { InitializeComponent(); Initialize(); GlobalVar.Username = Microsoft.VisualBasic.Interaction.InputBox("Welcome to EasiGame, Please enter your username.", "Welcome", "Player1", -1, -1); label4.Text = GlobalVar.Username; }

This references VB, and that works great, however could I include radio buttons or something in this box, or a separate box, to grab user input for a difficulty setting. Thanks in advance!

Answer1:

You would have implement your own form. Assuming you're using a recent version of Visual Studio:

<ol><li>Click Project > Add Windows Form.</li> <li>Set the FormBorderStyle property of the Form control to FixedDialog to prevent the user from resizing the form.</li> <li>Set the MinimizeBox and MaximizeBox properties to false.</li> <li>Set the StartPosition property to CenterScreen or CenterParent.</li> <li>Add a button to the form with the text OK and set the DialogResult property to OK.</li> <li>Add a button to the form with the text Cancel and set the DialogResult property to Cancel.</li> <li>Change the AcceptButton property of the form to reference the OK button.</li> <li>Change the CancelButton property of the form to reference the Cancel button.</li> <li>Add a TextBox and a RadioButton or CheckBox control to the form.</li> <li>Press the F7 key to open the code view for the form.</li> <li>Implement a property of type string that returns the Text property of the TextBox control.</li> <li>You'll also need to come up with a way of getting the difficulty from the form; I'll let you figure this part out for yourself :)</li> <li>To show the form, create an instance and call the ShowDialog() method. This will block the calling method until the user has clicked a button. The ShowDialog method will return a DialogResult, which can be used to determine which button was clicked.</li> </ol>

Recommend

  • Can You Use An If Statement For .Body For Email Functionality Onclick Of A Button
  • How I can access to the “Text” Property of a ListView LayoutTemplate Control
  • Creating columns from results in Hive
  • get() missing 1 required positional argument: 'self'
  • What is the difference between GetComponent ().enabled and .SetActive (false); in unity
  • Youtube Video Player Fullscreen click event
  • Pointer vs Reference difference when passing Eigen objects as arguments
  • LNK1104: cannot open file 'kernel32.lib'
  • Creating a Multi-Step Modal Using Jquery
  • Can my PDF ping my server when it is opened?
  • Flash radiobutton: how do I get the selected radiobutton?
  • How can I replace the server in Web Component Tester
  • Pycharm: Marking a folder as 'sources root' is not recursive for subfolders
  • Ajax calls do not work in IE unless you fiddle with security settings
  • Debug.DrawLine not showing in the GameView
  • Keep this build forever option - Jenkins
  • Android full screen on only one activity?
  • Java Scanner input dilemma. Automatically inputs without allowing user to type
  • Is there any way to access browser form field suggestions from JavaScript?
  • Fetching methods from BroadcastReceiver to update UI
  • Does CUDA 5 support STL or THRUST inside the device code?
  • MySQL WHERE-condition in procedure ignored
  • How to show dropdown in excel using jrxml (jasper api)?
  • what is the difference between the asp.net mvc application and asp.net web application
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • Adding custom controls to a full screen movie
  • Web-crawler for facebook in python
  • Matrix multiplication with MKL
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Proper folder structure for lots of source files
  • Buffer size for converting unsigned long to string
  • trying to dynamically update Highchart column chart but series undefined
  • Hits per day in Google Big Query
  • How to get Windows thread pool to call class member function?
  • Authorize attributes not working in MVC 4
  • Busy indicator not showing up in wpf window [duplicate]
  • Binding checkboxes to object values in AngularJs
  • Python/Django TangoWithDjango Models and Databases
  • java string with new operator and a literal
  • Net Present Value in Excel for Grouped Recurring CF