VS 2008 Formatting Strings In .Net?
Apr 1, 2009I need to make sure that a certain textbox only allows dates to be entered under a certain format EG: DD/MM/YYYY
View 8 RepliesI need to make sure that a certain textbox only allows dates to be entered under a certain format EG: DD/MM/YYYY
View 8 RepliesHow to use the format function to remove any quotation (;, :, . , " ' etc) from a string. If it cannot be done with format then what is the possible solution?
View 2 RepliesI am working on a UDP Client/Server, and currently i have them sending back and forth strings, which i convert to bytes, and then open the bytes to read. I want to now send an Object instead of those strings, which includes multiple unsigned integers and strings.
View 39 RepliesI'm migrating from VB6 to VB.NET, in hence my questions below:
I have to write a function that returns array of strings.
How can I initiate it to empty array? I need it since I have to check if it's empty array after it returns from this function.
Is list of arrays better for this purpose? If I use a list - Is it empty when it firstly defined? How can I check it it's empty?
Say I have a List(Of Tag) with Tag being an object. One member of Tag, Tag.Description, is a string, and I want to make a comma-separated concatenation of the Description members.Is there an easier way to do this than to read the Description members into a List(Of String) and then use the Join function?
View 2 RepliesI have some VB .NET software that interfaces to a load of old (but sound) COM objects. The VB provides a GUI for the COM objects, part of which consists of setting various options on the COM objects - several of which relate to string formatting.I have a simple pair of VB .NET functions that convert basic %f, %d, %g formats to/from .NET equivalents using a large select case covering specific common strings, but they don't cover all formats.[code]Before I start diving in and making it more versatile with some parsing, does anyone know of a class (eg VB or C# .NET) that provides a decent ready-made implementation? Or perhaps some regexp wizadry could be used?
View 2 Repliesif this is not the right area to be posting this. I couldn't find an area dedicated to discussion about IDE features.Somehow one of my .vb files is not showing the nice formatting that is default in VS2008, such as the text colors, etc. how I can get this back? I don't know what to search for, as I don't know what its actually called. On the left you see what I want, and on the right you see what I have right now.
View 4 RepliesI have a program that is calculating the cost of a certain number of plane tickets, the validation and basic calculations are fine the only problem i've got this: There is a discount text box field called "txtDiscount" where IF a user enters a number it will discount this as a percentage off the total cost of all the tickets, but I cannot get it to work [Code]
View 2 Replieshave a really annoying VB 2008 problem and I'm hoping someone knows how to solve this. I implement the following code:
Code:
DispArrDate = MonthArr & "/" & DayArr & "/" & YearArr
DisplayArrDate.Text = DispArrDate.ToLongDateString
So basically, I'm getting date information from the user and trying to convert it into a date format, and show it to the user in a text box which is obviously named "DisplayArrDate", and "DispArrDate" is a date variable and "MonthArr" & "DayArr" & "YearArr" are strings which are always numbers because they are selected from a drop down combo box.
Now, the code works perfectly on my computer and some others, but for some unknown reason, on some computers, even if they have the same local date settings, it gives me the error: "Conversion from string "4/13/2009" to type 'Date' is not valid.", that's just one example, where "13" is obviously the day. I use the month/day/year format because, in the toturial I'm reading, it tells me, that no matter my local date settings, when using VB 2008, the month/day/year format should always be used and it will display a date in the local format automatically. It seems that on some computers, this isn't the case, and the month/day format is creating errors.
formating a date here
Dim dt As DateTime
dt = dsTitles.Tables(0).Rows(0).Item("servicedate")
lbldate.Text = Format(dt, "dd/mm/yy HH:MM")
The original date is - 19/08/2008 00:00:00
the date that variable dt gets is - #8/19/2008#
the final result is - 19/00/08 00:08
Good day to all of you again, I've been looking into this problem for several hours now and I can't find what is wrong with my piece of code
[Code]...
I have this string "0.9874" and I would like to use vb code to change it to "0.9.8.74" so that it looks like a proper version number.How do I do this? String.Format("{???}",MyString) or perhaps:
View 8 RepliesA TimeSpan by default shows hours, minutes & seconds when converted to a string. How do I show only hours & minutes? I tried ts.ToString("hh:mm") but that doesn't work.
View 7 RepliesI want to make an application that allows you to format a drive.My application consists of a combo box (so user can select drive) and a format button to format the selected drive.
I would like to know is this possible and if so how?
I'm a bit rusty when it comes to formatting the old xml's lol i can write them fine, i have this so far:[code]
View 3 RepliesExample:
Format(781234.57,) 781235
Format(781234.57) 781234.6
Format(781234.576) 781234.58
[code]......
I have two labels, one that will show the total gallons used in a journey and one that will show the total litres, both of these labels refer to their own Integer variables. How do I get the results to be shown only to 2 decimal places? This code below seems to work with Gallons but not with Litres?
[Code]...
PROJECT TYPE: Windows Forms Application
LANGUAGE: Visual Basic
.NET VERSION: 3.5
[code]....
I am attempting to display time in a label on my MainForm. The label should display a stopwatch control's elapsed time in hh:mm:ss format. My code is displaying "00:00:00". I have defined the hh, mm and ss as variables but I can't seem to figure out how to use them effectively.
vb
Public Sub RefreshTimeElapsed()
' Refreshes time elapsed display.
Dim hh As String = Me.MyStopWatch.Elapsed.TotalHours.ToString
[code]....
i am trying to display a line of smiley faces ☻ and change the colour of each face, i cant use a find method as there are 10 of these smilies so i thought about using a loop and selecting only the last one entered and changing its colour. here is a simplified version of my
VB.Net
For a = 0 to 9
RichTextBox1.Text += "☻" ' add the smiley
[code]....
This when i ran it changes the first nine to the first colour in the array and correctly does the colour of the last smiley? could i for instance format the character first then add it formatted?
So i wrote a script which does a few things and richtextbox2 is updated as follows:
a = 27,130,000,000
b = 2,930,000,000
c = 4,290,000,000
Problem is, when i copy the contents of richtextbox2 to the clipboard using "clipboard.settext(richtextbox2.text)" and then open up note page, and paste the clipboard contents, it is wrapped wrongly and i get the following in note pad:"a = 27,130,000,000 b = 2,930,000,000 c = 4,290,000,000"
I am using "system.envoronment.newline" in my code to start a new line.
I have a text box that displays a phone number. The data is coming from a database.Right now it just displays as "xxxxxxxxx". I'd like to display it as "xxx-xxx-xxxx" or even "(xxx) xxx-xxxx"Here's the code that I'm currently using to display the phone number - PhoneTextBox.DataBindings.Add("text", aBindingSource, "Phone")What can I add to this line to get some formatting?
View 2 RepliesI'm using Visual Basic to assign a dynamic dataset to a gridview control. The VB calls a stored procedure on SQL Server which always returns the last 28 days of info and displays it in the gridview with the column headings as the date.
[Code]...
I am currently trying to save a piece of data extracted from a piece of hardware in my office and save it as a text file. The problem now is, the text file saves the data like this:
[code].....
There are 3 buttons and 5 textboxes in my program. ignore the "plot" button as that is a machine specific code, as well as any weird lines like
Dim mgr As Ivi.Visa.Interop.ResourceManager
as these were provided by my machine vendor. I only need help with the data formatting.I am trying to program the "Agilent 8757D Scalar Network Analyzer.
I have a DGV and a TextBox into my form. The TextBox displays the "DGV.rows.count" for example as "3" but i want to show me "00003". How can i format this textbox to display data like "000XX"?
View 3 RepliesWorking on a class project where one heading in a lisbox has to be indented while the subsequent information has to be right-justified. Not sure how this is done.Have tried writing code like:
'To list cost of parts in listbox
''Formatted so value is in U.S. currency
lstTotal.Items.Add("Parts" & ControlChars.Tab & ControlChars.Tab & ControlChars.Tab & parts.ToString("C"))
But using ControlChars.Tab over and over again doesn't seem very efficient. The spacing in the listbox looks uneven and the code looks more cumbersome--less easy to read.
I have a cell in a grid view that I want to do custom formatting on. I figured out out to format the cell I'm checking but I want to format another cell called URL. The code below formats the cell "PingStatus", but how do I format another cell in the same row. I want to format a cell called URL .
Private Sub DataGrid_CurrentStatus_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGrid_CurrentStatus.CellFormatting
[code].....
I have some questions formating my datagrid and its columns but unfortunately unsuccessfully. How to change the alignment of a DataGridViewTextBoxColumn? I could only set the alignment of the whole datagrid. I tried to do this by code but it didn't do anything:
datagridOnlineStores.Columns("osowner").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
I tried defaultcellstyle but it doesn't do anything then is there any way I could change the color of the border of the whole datagrid because it's black I don't like it.
[Code]...
When x is nullable I get an error 'Overload resolution failed because no accessible ToString accepts this number of arguments'. I suppose I could copy the nullable variable into a non-nullable variable, then format it, but that seems extremely clumsy for something that should be fairly simply. Isn't there a better way?
Arghh! Copying the Date? variable into a Date variable doesn't work-Option Strict is On & that sees the two variables as being of different types. Is it really necessary to to an explicit CDate conversion on a nullable date variable?
[Code]...
I would like to have my output in columns, and the numbers in two digit after the decimal.
I am writing a data validation app where the app asks the user for input like give me a number of double type: and hopefully the user will comply.
But the app will test some validation rules and then:
1) if the user simply pressed enter the app will tell the user all sorts of reasons why the input was rejected. And that part should look like a table with columns for the entry, if it passed true, otherwise false and then the reason line empty input. Or this number is a string.
I am working on a vb6 to vb.net migration project using vs 3.5. I have a datagridview.in a particular cell of this grid, user has to enter only numeric data. but after user enter data, itshould become concainated with a $ symbol (eg: if user enter 34, the cell value should become $34). And if he/she presses the hyphen ("-") in the key board, the data (ie. $34) should become -$34 and if again presses the hyphen button in key board, the data should become $34.
View 3 Replies