Questions on C#
I want to make a list or array that holds names. It should start at 0 and increase with each entry on a button press, which will only be possible if there is some form of text in the input field.
Any help would be appreciated.
Any help would be appreciated.
Comments
in all files that use the List
@dislekcia I'm asking about the logic for the button only working with text in the input field.
the first will have the user still able to click the button but nothing will happen unless there is text in the relevant fields
and the second will disable/grey out the button until text is input, the second method may or may not be less efficient.
for the first method you just need to wrap the button code(inside the button pressed event) in an if statement that checks the textbox.text != ""
you can also prevent accidental duplicate entries by clearing the text field after the button logic.
the other option is to add some logic to text box itself if you have a text changed type of event, in this event you check that the textbox.text =="" and if it is empty set button1.Enabled to false else set it to true, and make sure the button starts out disabled and the textbox empty.
you can use these two together as well.
you could also update the button every so many frames and just check if there is text in the text field, and enable or disable the clicking based on the outcome.
hopefully this is helpful and I'm not mistaken in what you are looking for