|
suppose the following:
dim str as string = "****abc***xyz***"
dim str2 as string = str.trim()
'str="abc***xyz" , where each star is a space
'its cut the spaces from the two sides
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
hi,
dim test as string = " test "<br />
textbox1.text=test 'will give you " test "<br />
textbox1.text=test.trim() 'will give you "test"<br />
textbox1.text=test.trimStart()'will give you "test "<br />
textbox1.text=test.trimend()'will give you " test"
basically, it will remove the white spaces from the string.
hope this helps
regards
|
|
|
|
|
hello frnds,
trim() is basically to remove the spaces from left and right side of the string
let take an example
txtPfr.text = "****prasad****"
trim(txtPfr.text)
then it removes the sapce from both side
likewise u can use Ltrim() and Rtrim() methods too.
to remove Left and Right side sapces respectivelly.
best luck
regards,
koolprasad2003
If the message is useful for U then please Rate This message...
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
hi all
i have a label that displaying a date in the format("dd-MM-yyyy"), but my problem is that i want to save it in the format("MM-dd-yyyy").
this what i tried to do:
dim dt as DateTime = CType(lblApplicationDate.Text, DateTime)
and this is the error i got:
String was not recognized as a valid DateTime.
what i have to do to solve this issue ??
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
hi,
provide the format in the tostring() function. try this:
yourLabel.Text = yourDateTimeObject.ToString("mm/dd/yy")'or ("dd/mm/yy") or whaterver acceptable format.
hope this helps
regards
|
|
|
|
|
thank you ..
but i have no problem with displaying format, the problem is how to save the date in different formats.
check this
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
where exactly do you want to save it?
you could use the various properties like day, month, year ... provided by the datatime object to create a string that you like and save it to ....
regards
|
|
|
|
|
1119 wrote: you could use the various properties like day, month, year
actually this is the way i used to solve it.
but i don't think it is the best way to solve the problem
thank you
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Tamimi - Code wrote: actually this is the way i used to solve it.
but i don't think it is the best way to solve the problem
the best way depends upon where you want to store the data.
you have not made it clear where you want to save it? i asked you in earlier post.
if you are saving the data in a database then you will have to store the datetime object, but if you are storing it in a text file, you can't do that.
you will have to format it. for example save the year,month,day... in a file and use it when you want to create a datetime object: datetime dt = new datetime(year,month,day) or you can save the ticks and use it to create the object when you read from the file like: datetime dt = new datetime(ticks)
hope this helps.
regards
|
|
|
|
|
Where are you going to save it? If you are saving it to a database, you should not save it as a string, but a date.
Use the DateTime.ParseExact method to parse the string. You can use any date format that is possible to specify as a format string.
---
single minded; short sighted; long gone;
|
|
|
|
|
hi Guffa :
simply my question is : if i have a string contains
a date (suppose 17/06/2007 format dd/mm/yyyy) how to convert this value to
a valid date if my data base has the date format mm/dd/yyyy
(or any date format) ??
thank you
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Tamimi - Code wrote: if my data base has the date format mm/dd/yyyy
Stop. Database's don't have a format for a date, unless you made the mistake of storing the date as text. Pass the date to a parameter in your SQL insert and you pass this parameter a DateTime value, not a String.
|
|
|
|
|
Dave Kreskowiak wrote: Stop. Database's don't have a format for a date,
in MS server i could enter a date 06/17/2007.
but i could not enter 17/06/2007 .
can we consider this a date format problem ??
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Nope. I call it a validation problem.
You're not putting the date entered by the user into a DateTime value. You're just taking the string and putting that directly into an SQL statement. That's a really bad idea.
If you use a parameterized query, the parameter will format the DateTime value for any SQL Server localization for you. All you have to do is get the text the user entered into a DateTime value, validate it so it's inside a good date range, then pass it to your SQL code.
|
|
|
|
|
If you are going to save the Date in the DB go with Datetime Format. not by String datatype.
In case if you have used the datatype as string then you should go with
Use the DateTime.ParseExact method to parse the string.
Regards,
Satips.
|
|
|
|
|
Wy are you getting this from a label? Why not just get the date/time value from the original variable that set the label's date? No conversion and no parsing will be involved then.
|
|
|
|
|
Hey,
I've drawn a drawing in form. For example I have drawn line or circle or ... My problem is I want to save this drawing as image file. Can anybody give me an idea how I can do this?
I appreciate your help.
hsprasain
|
|
|
|
|
Draw it onto an Image or Bitmap, then call it's Save method.
If you're already drawing in the Paint event, then just create a member Bitmap, draw onto that, and draw that in your Paint event.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
In my code I creat a piechart.
What I have done is stripped down the code to show you what goes where (This code will not work as it needs declarations and values...).
This code will in effect make the picture 'stick' to the form - so that it does not get erased as you move the form.
Panel1 is where the piechart is being drawn.
Width and Height are variables you need to set to the size of the picture you want.
You will also need to include the Panel1.CreateGraphics.DrawImage(b1, 0, 0) command in the Paint event of the objetct you are drawing onto - in fact this is where the magic of this method is...
Give this a go and good luck...
Regards
Guy
Cambridge
UK
Public b1 As Bitmap
Public g1 As Graphics
b1 = New Bitmap(Width, Height, Panel1.CreateGraphics())
g1 = Graphics.FromImage(b1)
g1.DrawPie(Pen:=myPen, rect:=New Rectangle _
(x:=x + XAdjust, y:=y + yAdjust, Width:=Width, Height:=Height), _
startAngle:=startPos, sweepAngle:=sweep)
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
Panel1.CreateGraphics.DrawImage(b1, 0, 0)
End Sub
You always pass failure on the way to success.
|
|
|
|
|
hi
i am very amator in vb.net i want build an editor program like notepad whit vb.net but i cannot build menu and their code like open in file submenu and save and ...
please guide me and help.
thanks a lot
|
|
|
|
|
Really, your best bet is to buy a book and work through it, or look for some tutorials online. Building a menu is simply a case of dragging it onto your form, and clicking where you want menu items to be, to add them. Making them do something is as simple as double clicking on them in the editor. The code is also fairly simple, just use the FileOpenDialog and FileSaveDialog classes.
But, again, if you're asking this, you're probaby enough of a beginner, that you really need to rely on a book to get you started, as you'll get more structured and consistent help than you cn get from forum replies.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi
i am very amator in vb.net programming i want build a editor program like notepad in vb.net but i cannot build menu and their code for menu like open frome file submenu and save and ...
please help and guid me
thanks a lot
|
|
|
|
|
Hi experts,
I need a vb script(.vbs) to convert a Excel file to Html file. Is it possible?????
Regards....Sagar
|
|
|
|
|
Of course it is possible. Anything is possible when you are programming!
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Iam creating a Text Editor and i have added a toolsrtip control in the form with 7 buttons on it . The size (height) of the toolstrip control is very small. so the buttons on it appear very small. I want them larger(both by length and breadth) and by default the size of the toolstrip control cannot be changed form the Properties window. Please kindly tell me how to change the size.
Aniket Sonawane
|
|
|
|