|
It doesn't work that way. NumberFormatInfo applies to format specifiers, not the default format to show any number without a specifier. Do this:
MyTextBox.Text = myDouble.ToString("N4")
Trupti Mehta wrote: ' Calculate UFI WORKING PERFECTLY FINE
uif = ((Me.salary * 1) / 100)
Me.uifTB.Text = uif.ToString(nfi)
uif = Double.Parse(Me.uifTB.Text().Trim())
Please tell me you're not serisously using this to trim a number down to however many decimal places? Are you??
|
|
|
|
|
Dave Kreskowiak wrote: Please tell me you're not serisously using this to trim a number down to however many decimal places? Are you??
Dave, I want to show and save all doubles with just 2 decimal values. That's it. To achieve the goal, I found NumberFormatInfo.DecimalNumber function, that can do the work.
Thanks
Terry
|
|
|
|
|
Trupti Mehta wrote: I found NumberFormatInfo.DecimalNumber function
That's not a function, it's a property of a NumberFormatInfo object, which is part of a culture.
If you want to believe that this will do the job for you, go right ahead and have fun. It's doesn't work the way you think it does.
If you were one of my coders and I saw you rounding a number using this method, I'd probably ask you what youwere thinking, and then fire you. Converting a number to a string, trimming it, then reparsing the numebr?? You honestly can't think of a purely mathematical solution to do this??
|
|
|
|
|
hi there
i m working on this application which involves drawing a line from point A to point B. After the line is drawn i trigger an event and the line has to be redrawn again but this time it should be half the length of the original line and should replace the original line.
At the moment i can draw both the lines but i dont know how to get rid of the original line.
Any ideas/code on how i can go about to solve this problem?
regards
Yasin
|
|
|
|
|
Hello Yasin,
You may draw a line of the length of original line with the Form color which will make original line invisible, then draw second line which is of the half size.
Following is small code snippet which shows this behavior-
--------------------Code Start----------------
Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)
Dim formGraphics As System.Drawing.Graphics
formGraphics = Me.CreateGraphics()
formGraphics.DrawLine(myPen, 0, 0, 200, 200)
Dim myPen1 As New System.Drawing.Pen(Me.DefaultBackColor)
formGraphics.DrawLine(myPen1, 0, 0, 200, 200)
formGraphics.DrawLine(Pens.Black, 0, 0, 100, 100)
myPen.Dispose()
myPen1.Dispose()
formGraphics.Dispose()
--------------Code End----------------------
I hope this helps .
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
it's easyer to use
formgraphics.Clear(me.BackColor)
be carefull tho it will remove all drawings so if you have anything else drawn to the form they will be removed too
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
Hi All,
I wanna check for (private,Pvt,(P)) using regular expression in vb.net
and compare two names as ABC private Ltd and A B C pvt Limited
)
Thanks and Regards,
Ahmad
|
|
|
|
|
You might want to check out Expresso[^]. It's a very good regular expression writer/tester.
|
|
|
|
|
How can I read the text file from different position say from position 03(column 1), position 04 to 19 (column2) ..and so on. till the length of record.Then how can I get the values and write the values in csv format?.Please Help out.
C.Sridevi
|
|
|
|
|
Have you looked at the classes in the System.IO namespace?
The File class has static methods for reading and writing text data to files.
I suggest you read the documentation and attempt to write some code based on the examples in MSDN. If you have any specific problems after doing this, come back and ask again.
Paul
|
|
|
|
|
I could read and write the line using stream reader and stream writer.But I need to get the values from a column in a text file.After getting those column values,i need to write it in csv format..how i do this?
C.Sridevi
|
|
|
|
|
Hi,
Here is how to read the file in one chunk (very fast):
<br />
Dim inString As String<br />
Dim stringArray() As String<br />
<br />
fileReader = New System.IO.StreamReader(FileName)<br />
inString = fileReader.ReadToEnd()<br />
fileReader.Close()<br />
stringArray = inString.Split(vbLf)<br />
You will then have to parse each line, in stringArray, separating fields at the relevant points.
That is where you will have to do the work.
What you have asked for does not have a quick and easy answer.
Read up on CSV file formats via google then apply your VB .Net knowledge to parsing each line.
Hope this helps
You always pass failure on the way to success.
|
|
|
|
|
There is no need to write a parser to split the lines into a string array. Look at the Microsoft.VisualBasic.FileIO.TextFieldParser class. It will parse fixed width or CSV text files a line at a time.
|
|
|
|
|
Thanks for that.
Oh man - I wrote a csv classs to read and write csv files
I guess I learnt about csv files in the process though
You always pass failure on the way to success.
|
|
|
|
|
Hi All,
How can I call the existing libraries containing unmanaged C++ classes in a vb.net project.
Thanx In Advance.
Paramhans Dubey.
|
|
|
|
|
If they are in dlls, you can p/invoke them. www.pinvoke.net[^]
Christian Graus - Microsoft MVP - C++
"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 Christian,
Thanx for your help.
Paramhans Dubey.
|
|
|
|
|
I am working in DataGridView. if 40 row is selected i want to show the 40th row to the user automatically without scrolling with mouse.
some one solve the problem plzzzzzzzzzzzzzzz
sumit
|
|
|
|
|
rahul sumeet wrote: some one solve the problem plzzzzzzzzzzzzzzz
I went to teh documentation of the DataGridView and looked through the properties list, and in about 15 seconds I found the FirstDisplayedScrollingRowIndex property. That sounds like it might do what you want.
|
|
|
|
|
I have written code to upload single file to FTP Server using FTPWebRequest class of VB.Net 2005.
Now I want to create folder on FTP server and then upload multiple files into it.
Just tell me how to create folder on FTP Server using FTPWebRequest class or any other method in vb.net 2005.
|
|
|
|
|
hgs24shravgi wrote: I have written code to upload single file to FTP Server using FTPWebRequest class of VB.Net 2005.
Now I want to create folder on FTP server and then upload multiple files into it.
It's done just about the exact same way to uploaded a file. Just change the Method of the FtpWebRequest object you create, then execute it with the GetReponse method.
Dim request As FtpWebRequest = DirectCast(WebRequest.Create("ftp://someurl"), FtpWebRequest)
request.Method = WebRequestMethods.Ftp.MakeDirectory
Dim response As FtpWebResponse = DirectCast(request.GetRseponse(), FtpWebResponse)
Debug.WriteLine("MKD response: " & repsonse.StatusDescription)
response.Close()
|
|
|
|
|
I am able to upload and download single file using demo on this URL -
http://www.codeproject.com/cs/internet/SimpleFTPDemo.asp
I converted that code to VB.Net
But now I want to upload and download one complete folder which may contain sub folders.
So i want to know how to download complete folder
|
|
|
|
|
You have to download the files one at a time, and also see what subdirectories are in there, navigate them in your code and download the files in those, one at a time.
|
|
|
|
|
Dear All,
I am using vb.net and creating a simple application like wordpad.I used the Rich text box control as the platform.I can insert the picture in Rich Text box control,But my problem is thai i can't save the created file with the inserted picture only text content are saved.I choose the save option in (*.Doc)format.Please help me i am new in .net technology.
|
|
|
|
|
Hello,
If you have image in a Rich Text Box, you may use following line of code to save it with image-
RichTextBox1.SaveFile("C:\FileWithImage.rtf", RichTextBoxStreamType.RichText)
You may save this data directly to RTF file using .rtf extension. This rtf file can be opened in MS Word or can be loaded in RichTextBox again using LoadFile method.
I hope this helps .
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|