i am using a normal textbox.
i want that it should remain in this format "0.00" all the time.
when the form opens, when the data loads in it, when the user leaves the textbox, etc.
Printable View
i am using a normal textbox.
i want that it should remain in this format "0.00" all the time.
when the form opens, when the data loads in it, when the user leaves the textbox, etc.
I am new to vb.net but you may want to check out the placing the format in form_load event and the textbox_leave event or something similar?
put this in the load_form event of your form !
VB Code:
TextBox1.Text = "0.00"
Use the mamask.ocx from system32 folder it looks like a text box
and you can format how you whant in the help in vb.net there is good info,
huh ?Quote:
Originally posted by cgj
Use the mamask.ocx from system32 folder it looks like a text box
and you can format how you whant in the help in vb.net there is good info,
Don't use an OCX, that is a COM control. You want to avoid using them in .Net as much as possible.
You can use something like this. The first value is the text you want formatted.
text1.text = format("21.22","Currency")
or check this link for a control you can easily use:
http://www.c-sharpcorner.com/winform...dTextBoxJP.asp
hi hellswraith
Well i didn't program before .net,
What is wrong with com in .net?
You can do it, but .Net will create a COM wrapper class around it, and make calls to it, which in turn makes calls to the COM object. This would be slower than using something native to the .Net framework.
Sometimes you can't get around it....and that is alright. Just try not to use COM if you can help it. The general rule is to make sure there is no .Net way of doing it before using COM.
Also, I have found some problems with COM classes myself. Sometimes methods don't work as they should. That just is my experience.
Hope that helps.
Good to know thank you