|
DateDiff is apparently giving you the number of days between the two dates, not inclusive of the actual days that the dates fall on. If you pick Thursday and the very next Friday, DateDiff(Day) will will return 0. If you pick Thursday and Saturday, it will return 1.
The solution is to just add 1 to whatever DateDiff returns.
RageInTheMachine9532
|
|
|
|
|
If your using VB.Net there is also the System.Timespan Namespace.
You could try something like:
<br />
Dim d1 As DateTime = DateTime.Now<br />
Dim d2 As DateTime = d1.AddMonths(2)<br />
<br />
Dim ts As System.TimeSpan = d2.Subtract(d1)<br />
Dim sDays As String = ts.Days.ToString()<br />
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
LearnVisualStudio.Net
|
|
|
|
|
Cool, that did work.
Thanks again. I maybe calling again on my next project.
Thank you,
ibok23
|
|
|
|
|
Hi,
I'm having a bit of a brainteaser.
What I have:
A typed SQLDataTable with 2 columns with some GUID's and decimal values which represents percentages. I need them to be decimal for the obvious calculations.
What I want:
- Show the values in a ComboBox
- Format them using the local Percentage formatting (difference between 0.1 and 0,1 in most European countries) as you do to format strings with FormatPercent(...)
What I do:
cboPercent.DataSource = DataSetSomething.SQLDataTablePercent
cboPercent.ValueMember = "PercentID"
cboPercent.DisplayMember = "Percent"
The problem:
The ComboBox shows something like 0.2100 instead of 21.00 % or 21,00 %
I don't really know where or how to implement the formatting.
Any help is welcome
Karsten Habay
Belgium
|
|
|
|
|
I have been searching for hours and can't seem to find the answer to this, so maybe it doesn't exist. However, I'll give it a try.
I want to read the audio tracks on a CD. I know how to write data to a .wav format, but can't figure out how to read the data on the CD. I'm sure I can play the audio and write it to a wave file, but this would be done it real-time and would thus be a little on the slow side. Any help would be greatly appreciated.
Thanks!
|
|
|
|
|
You might want to check into someone elses source first before you decide to even attept this. You won't find any examples written in VB or VB.NET for a reason...
Check out the source for CDex on SorceForge: http://sourceforge.net/projects/cdexos/[^]
RageInTheMachine9532
|
|
|
|
|
Now I feel like a total idiot. I can't find source code anywhere.
If I have to go with an external program, I'd like one with a command line interface so I can just call it from inside my code. I'm just trying to write a program to do a very specifice task with audio files.
|
|
|
|
|
Click on the "Browse CVS" link at the bottom of the page.
Also, you might want to download the 1.5.1 release. The .zip file doesn't have to source files in it, but it does have .DLL's that you might be able to use to rip tracks and encode them.
RageInTheMachine9532
|
|
|
|
|
Thanks! You're right, though: This may be WAY more work than it is worth. I'll have to plow around source code for a while...
If anyone else has any other solutions, please let me know.
|
|
|
|
|
Hello,
I am new to vb.net and I need to know how to pull the value of a certain field from a dataset that i have already filled, to use for to compare to the users input in an if statement.
Thanks for the help
Mariscal
|
|
|
|
|
Im not too sure if this is what you are trying to do but:
if form1.DataName1.Data1 = form1.DataName2.Data2
|
|
|
|
|
I assume that your Dataset (lets call it ds) has a single table.
So the nth field of mth row will be :
ds.Tables(0).Rows(m).Item(n)
"I think there is a world market for maybe 5 computers"
Thomas Watson, chairman of IBM, 1943
"There is no reason anyone would want a computer in their home"
Ken Olson, chairman & founder of Digital equipment, 1977
"This 'telephone' has too many shortcomings to be seriously considered as a means of communication. The device is ingerently of no value to us."
Western Union internal memo, 1876
"640 K ought to be enough for anybody."
Bill Gates, 1981
"Computers in the future may
|
|
|
|
|
Thanks for the help Pradeep C
Santana
|
|
|
|
|
I am having problems trying to change a number into a dollar amount. For example, an object = $10.50, it will only allow me to have 10.5. I am not sure how or what to do to have it with the dollar sign and with 2 decimal places if it = $10.00.
Thank you,
ibok23
|
|
|
|
|
If this is 'old' VB, check out Format$.
Steve S
|
|
|
|
|
Fomat would be under properties right? I do not have that under my properties. I am using visual basic.net.
Thank you,
ibok23
|
|
|
|
|
You're a real beginner at this aren't you?
What you would do is store the decimal version of the currency in a variable. THen when you need to show the value in a currency format, you supply the Format specification. Something like this:
Dim amount As Single
amount = 10.5
Console.WriteLine("Amount is " & Format(amount, "Currency"))
Console.WriteLine("Amount is " & Format(amount, "C"))
Console.WriteLine("Amount is " & Format(amount, "$###,##0.00"))
All three Format specifications do the exact same thing. The one exception is the "Currency" and "C" specifications will use the format of the Windows Locale currentcy format, specified in the Regional and Language Options Control Panel.
RageInTheMachine9532
|
|
|
|
|
Yes, I am a newbie. I have a box that is going to = $10.00. So I would write:
dim baserate as double = 84.5
costofroom.text = Console.writeline(Format(amount,"Currency"))
am i close
Thank you,
ibok23
|
|
|
|
|
Not quite...
I'm assuming you have a TextBox on your Form called costofroom. I'm also assuming that you want the 'baserate' to be displayed in the TextBox and not 'amount' like in my example code.
dim baserate as double = 84.5
costofroom.text = Format(baserate,"Currency")
RageInTheMachine9532
|
|
|
|
|
sorry about that.. i tried.
ok, I have put that in.. have not tried one more error.
if I have $0.00 dollars as the amount for a box additonalguestcharge.text
I put...
additionalguesstcharge.text = format(0,"currency")
getting an error..but of course.
now what.
By the way thanks for all the input.
Thank you,
ibok23
|
|
|
|
|
Try this...
Dim amount as double
amount = 10.5
Console.Writeline(amount.ToString("C"))
Free your mind...
|
|
|
|
|
maybe try
Console.Writeline(Format(0,"$#,###0.00"))
i havent tried this but i remember i used something just like it before, i forget exactly what it was. mess around with that if it gives an error. itll b just around the corner.
------------------------
Jordan.
III
|
|
|
|
|
First, what's the error?
RageInTheMachine9532
|
|
|
|
|
i am not sure. I just now ran the problem and I received a yellow arrow at one of my endifs.
Not sure what to do.
Thank you,
ibok23
|
|
|
|
|
I finally got it done. Now i am haveing problems with my total.
I am trying to add three boxes together. I love math and I know what to do. I put
total.text = ((subtotal.text) + (additionalguestcharge.text) + (rollbed.text))
in my answer it gives me
$209.00$5.00$10.00
instead of adding it up.
This is weird.
Thank you,
ibok23
|
|
|
|