VS 2008 Formating A Date?
Jun 24, 2010Date.Now.ToString return a string like "6/24/2010 3:31:27 PM". I only want the year to be 2 digits, like "6/24/10 3:31:27 PM". What's the best way to do this?
View 4 RepliesDate.Now.ToString return a string like "6/24/2010 3:31:27 PM". I only want the year to be 2 digits, like "6/24/10 3:31:27 PM". What's the best way to do this?
View 4 Repliesvb
DateAdd(DateInterval.Year, 1, CDate(Form1.DataGridView1.CurrentRow.Cells(1).Value).Date.ToString("yyyy/MM/dd")))
[code].....
Have a column of dates which i need to compare to a specific time of the year, which establishes what calculation needs to be applyed then depending on the outcome apply conditional formating to highlight an adjcent cell, but need to remove the YY element as the contents spans multiple years.
if the date in A1 is between 1st Jan & 14th Mar use -8
if the date in A1 is between 15th Mar & 15th Oct use -17
if the date in A1 is between 16th Oct & 31st Dec use -8
Then deduct the above value from B1 to give a target for each row (from 3 onwards)if the target is < the value in n then change background orange in f
I expected this to work[code]...
The date gets formatted according to local settings, but not the time.
I seen API examples but, dangit, this should be easy and built into the framework.
Why is it working for the date but not the time?
For example, check out my regional settings for displaying time [url]...
2 Listboxes gives values to listbox3 like "listbox1item:listbox2item"When I export it to txt file and open in notepad, it shows listbox1item:listbox2item listbox1item:listbox2item listbox1item:listbox2item but when I open same file on wordpad and other text editors it shows like
[Code]...
with express 2008;how can i code the datagrid basing on its cell contents
(1) it's column width
(2) row background color
(3) fore color
(4) font size
all properties are read only ?
I'm entering 123 into a field and getting 231.It's because I'm formating the text as I change it.
Private Sub txtObject_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtObject.TextChanged txtObject.Text = Format(Val(txtObject.Text), Zformat)
End Sub zformat is "0.0"
Initially the field is "0.0". If I highlight it and type "1" I get "1.0" the cursor is now in front of the "1",I then type "2" and get "21.0" and the cursor is in front of the "1",I then type "3" and get "231.0".
It is because the cursor is in the "wrong" position.Is there a simple way to fix this?
I got an email I just created using Outlook automation and I need some help to get it formated nicely:set Font of the body set font-style to bold of certain words insert a picture into the body (this is not an attachment) when putting text in the body using VB.net looks like outlook automatically adds spaces for each "paragraph", how can I get rid of these spaces? how can I get my signature on because it disappears when text is added to the body [Code]
View 11 RepliesUsing VB.NET 2010 I don't know, how I can format a decimal as wanted...
Example:
Value = 1 / Wanted Format = 0100
Value = 2,5 / Wanted Format = 0250
Value = 24,25 / Wanted Format = 2425
I have a richtetbox and i have it so that the user can change the font and the font color, does anyone know how i could get it to print with the formatting (font, size, color)?
View 4 RepliesI don't know how to format a timestamp in VB so it gets inserted into the MYSQL database in this format:
[Code]...
I am using the DateTimePicker control in a Vb.Net Windows project.I would like the date to reflect the Regional Settings on the user's computer, but also to show the month name, rather than the month number.For example, if my computer is set to English(US), I would like to see Nov 26 2009, and if my computer is set to English (NZ), I would like to see 26 Nov 2009Is this possible?
View 1 RepliesI have a datagridview and need to do some formatting to it. On load the row 0 column 0 cell is highlighted. I need users to click on datagridview to select a value. The issue is with the initial load highlight it looks like the first row is already selected when in fact it is now. How can this highlight be disabled? Each row of has 7 cell, the user is able to select any of the cell of a row and the corresponding row ID is selected. The issue is that only that one cell is highlighted.
I would like the entire row highlighted regardless of what cell in that row is clicked on. One of the columns is a status value. I would like to color the text based on the value. For example if the Status is opened I want the text to be red, if the status is closed the text color should be default.
I am working in VB.Net and trying to use Regex.Replace to format a string I am using to query Sql. What Im going for is to cut out comments "--". I've found that in most cases the below works for what I need.
string = Regex.Replace(command, "--.*
", "")
and
[code].....
Have a bit of code ported from VB6 to VB.NET. It uses Write and WriteLine all the way to produce output files.
Now, I need to compare outputs from original and ported code, but there's one tiny problem with number formatting. For instance whereas VB6 code Writes just .5, the VB.NET code produces 0.5, instead of .0005 (in original) it writes 5E-4, etc.
How can I make VB.NET's Write to write numbers in the same format as VB6? The option of refactoring writing code to include formatting step is not acceptable.
I have an access database that is populating a txtbox field on my form..How do I get those results to be currency?do I add code to the form? or do I add code to the function of the tbl? [code]I dont know which side to code or what to code to get the results to be formated as curency
View 17 RepliesVB.Net (2008) doesn't seem to allow inserting formating characters (eg.) in String.Format:
'BAD MessageBox.Show(String.Format("{0}{tab}{1}", "Foo", "Bar"))
'BAD MessageBox.Show(String.Format("{0} {1}", "Foo", "Bar"))
MessageBox.Show(String.Format("{0}" & vbTab & "{1}", "Foo", "Bar"))
Is there an easier way to build a formated string that must contain formating characters?
I Have a RTF File which i have exported from CrystalReportviewer Now i want to assign the exported RTF to a RichTextBox[code]..
The File is Loaded successfully.. But i m loosing the Formatting , i mean to say When i m opening the Same RTF Outside of the application its Showing the Format As it was in Report ... But While i m Attaching it to Application It looses all the formatting .
This is my second post and today I have the following problem:I want to make a Steam Gamertag Maker ..
1) I have a RichTextBox.
2) I have 8 buttons each representing a color (red, green, yellow, blue, teal, pink, white and black ..)
3.1) I enter some text into the richtext box.
3.2) I select part of the text.
3.3) When I press a button, e.g Blue and the selected text changes to that color.
3.5) I have a copy button, that copies the content of the richtextbox .. and that is where the problem starts .. (The copied text has no color and so on .
4) If I press, for example the Blue Button, I want that the following text "^4", is written just in front of the selected text and that the selected text is colored blue at the same time. The other text should not be affected by those adjustments ..
5) If the "^4" is inserted, it should be hidden
6) If everything is colored, I press the copy button and it should copy the whole text, including for example the "^4" ..
7) I want the "^4" to be hidden, because it looks better, but if I copy the content of the RichText box it should be included ..
If I have a RichTextBox and want output like the first line is a font with capital letters and bold, while the next line on the contrary, what should I do?
output like this:
MY NAME IS
Diana
My address is
China
how can i make it like IF (todays date is passed a specific date) then basically what i need is to see if the date is passed a static date i set in the vb code.
View 2 RepliesIn the TableAdapter configuration wizard I am using this query:
Code:
SELECT AttendanceID, StudentID, ClassId, DateOfClass, Absent
FROM Attendance
WHERE (DateOfClass BETWEEN #5/1/2010# AND #5/30/2010#)
Can tell me the correct syntax to change the #5/1/2010# AND #5/30/2010# so the WHERE clause uses dteStartDate AND dteStartDate which are date variables ?
I tried this but it tells me I need to use the to_date function. dteStartDate is already a date variable so I know my syntax is wrong.
Code:
SELECT AttendanceID, StudentID, ClassId, DateOfClass, Absent
FROM Attendance
WHERE (DateOfClass BETWEEN #" & dteStartDate & "# AND #" & dteEndDate & "#)
Title pretty much says it all. How do I format the date of a dateandtimepicker to insert it into the SQL date datatype?
View 20 RepliesI just D/L VB express 8, and I'm trying to learn how to use it. what I'm trying to do is write some code that:takes a number into a text box (textbox1.text)do some simple calculations with that number when I press a button (button1)display the results in a second text box 9textbox2.textThe first problem I am having:The numbers are in the "milli" range, meaning to the power of negative three, so 10^-3 = 0.01 I do not want to enter 10^-3 or any other exponent into the textbox, I am simply entering in 10 because all my units will be in milli. I've tried using exponent and scientific notation but it doesn't calculate correctly. I've done a "work around" to get it to do what I want, but there has to be a simpler way to achieve the above results without. for example, the user enters 10 into the textbox, the button multiplies 10^-3 *30, as a crude example, and stroes that value (say, B=10^-3*30) and B is DIM B as Double.
Problem number two:Error checking. I need to validate that only numbers can be entered into the textbox, or else the program will display an error message (messagebox). I can achieve this to some degree with sample code from here and other places, but, some of the code does not take into account that some numbers have decimal places (I have foud code that does, and it does work), but if a users enters, say the letter "E", it crashes the program. If the user enters "10.3Z", it crashes the program. I cannot seem to code for the last case, a mixture of numbers and letters to get an error message box.
With a Time value in my program. Basically, I am importing a travel Time from a database e.g. 3:45 so it takes 3 hrs and 45 minutes to get from a to b. I then want to double this - 3:45 * 2 = 7:30, and then want to multiply it by a cost e.g. travel is charged at 25 per hour. so it would be total travel time = 7:30. Travel cost = 25. Total Travel Cost = 7:30 * 25. In the access db, it is stored as a text field, and then imported in vb as a string.
View 1 Repliesi m developing a window application using vb.net & ms sql server 2008. The date is by default mm/dd/yyyy. But i wanna change this to dd/mm/yyyy. How is it possible and where do i hv to make changes?
View 3 Replieshow I can ensure that conversion of a date to a string and a string to a date will give me the same date format.
For example:
Code:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim d As Date = Date.Now
[code].....
I'm actually only interested in the date part as the label text shows so f is more than I want.But also, the day and month are reversed.
i have 2 datetimepicker which are startdatedatetimepicker and enddatedatetimepicker.. the start date should not be more than end date..thus i need to check these two date.. here is my code...
[Code]...
I have a date time as a string, eg. "2010-08-02", I'm trying to convert it to UTC with the following code snippet..DateTime.ParseExact("2010-08-02Z", "yyyy-MM-ddZ", CultureInfo.InvariantCulture)When I print to the console, I get the following: 8/1/2010 5:00:00 PM.Is there a reason why the date shows up as the date before the date I'm trying to parse? I could just add a day to this to advance to the original day.
View 3 RepliesI dont know how to get the current date in visual basic 2008. Here is a sample code
regDate = Format(Date.Now(), "ddMMMyyyy")
The output is like 7/02/1900