vb.net - Adding items from textbox to a list(of string) -


i`m new vb.net. looking find out how add items list. @ moment,its adding 1 item. need save many items , must able display items in textbox. please help!

public class form1     private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click         dim patients list(of string) = new list(of string)         patients.add(textbox1.text)          textbox2.text = patients.count     end sub end class 

every time click button new copy of list variable created and, of course, empty. add 1 item that's end of game.
if want preserve contents of list, need move list variable @ global class scope

public class form1     dim patients list(of string) = new list(of string)      private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click          patients.add(textbox1.text)          textbox2.text = patients.count     end sub    ..... end class 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -