Question change and save the name of an listbox,or label,or textbox

edinet

Member
Joined
May 8, 2013
Messages
22
Programming Experience
Beginner
i want to change the name of a listbox or label,,or textbox,,and save it,
here is an img example

, save edit.png
when i pres change,,i wantthat the chenget name remain there .
..and for next time i open the applicatin,,,need an notepad database or something like that..please help
 
Hi,

To change the Name of any object at design time, whether that be a Button, TextBox or Label etc, then you just need to Press F4 which will open up the Properties window and then change the Name property which is at the top of the properties list.

Hope that helps.

Cheers,

Ian
 
i know that but,,i want to change the name,,when app is running,,,

example,,
the text is hello,,i change it to hello word
and when i run the application ,,,the text must be hello word
 
Hi,

example,,
the text is hello,,i change it to hello word
and when i run the application ,,,the text must be hello word

I must be a Mind Reader since I KNEW you were going to come back and say that.

The important difference in your second post is that you have said that you want to change the TEXT property of an object at Runtime and NOT THE NAME property of the object.

You cannot do this by directly affecting the object in question but you can do this by setting up a String variable in My.Settings that can be used and changed when you need to be displayed as the Text property of an object. i.e:-

1) Create a variable in My.Settings called myLabelText

2) You can then set and save this variable as follows:-

VB.NET:
Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click
  My.Settings.myLableText = "My Label Text To Display"
  My.Settings.Save()
End Sub

3) Then in the Load event of the Form you can say:-

VB.NET:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
  Label1.Text = My.Settings.myLableText
End Sub

Hope that helps.

Cheers,

Ian
 
thnx ian,,,but i need something else,,and i cant explain very well,,(im not good in english) im trying to explain with images
save edit.png
i want to write the textbox1 in form1 and show into textbox2 in form2 ,,,and the text in form2 will be saved when the app is running (not in vb) from "desktop or directory"
 
Hi,

Firstly, if you have a separate question to that which was originally posted then please create a new Thread to keep things uniform on the Forum.

That said, and in this case, to display information from your Parent Form on a Child Form then you can create a New instance of your Child Form and then set the properties you need before displaying your Child Form. i.e:-

VB.NET:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
  Dim mySecondForm As New Form2
  mySecondForm.TextBox1.Text = Me.TextBox1.Text
  mySecondForm.ShowDialog()
End Sub

and the text in form2 will be saved when the app is running (not in vb) from "desktop or directory"

What do you mean by this statement? Do you want to save to a Flat File, a Data File or a Database? If you want to use any of these principals, what do you know about these principals?

Hope that helps.

Cheers,

Ian
 
Back
Top