Simple way to save and load data Visual Basic

后端 未结 3 1374
一整个雨季
一整个雨季 2020-12-09 05:35

I was wondering what is the easiest way to save and load data through different forms in vb. I just want to save 3 textbox.text that a user saves and be able to load it on a

3条回答
  •  孤城傲影
    2020-12-09 06:05

    If it is a User setting you can use the built in My.Settings Object to Save and Load.

    From above Link:

    The My.Settings object provides access to the application's settings and allows you to dynamically store and retrieve property settings and other information for your application.

    You can create the Setting in your Project Property's Settings Section:

    Which you can access like this.

    dim MyTemp as String = My.Settings.MySetting
    

    and Save it like this

    My.Settings.MySetting = "StringValue"
    My.Settings.Save()
    

    This will be persisted in your Config file like this:

    
        
            
                TempValue
            
        
    
    

提交回复
热议问题