|
This is what I wrote, it still doesn't work but maybe I am close.
numberofdays.text = datediff(dateinterval.day, dtparrival, dtpcheckout)
dtparrival is my date picker for arrival
dtpcheckout is my date picker for checkout
numberofdays.text shows how many days they are there.
What am i doing wrong?
Thank you,
ibok23
|
|
|
|
|
ibok23 wrote:
numberofdays.text = datediff(dateinterval.day, dtparrival, dtpcheckout)
You're about half way there. The last two parameters you passed in are the references for the DateTimePicker controls themselves, not their values. Make the following change to get at the Value's in your controls:
numberofdays.Text = DateDiff(DateInterval.Day, dtparrival.Value, dtpcheckout.Value)
RageInTheMachine9532
|
|
|
|
|
ooookkkk,
I see.
I am still working on the currency part and then I'll debug it to see if it works. Hopefully. One more question if you don't mind.
numberofdays.text = (will be a number, correct)
ok what if I need to charge somebody $5.00 for every number of days
I wrote this and it didn't work
dim rollawaybed as double = 5
rollawaybedcharge.text = (rollawaybed * numberofdays.text)
then I have to put about the currency, but I am getting that this will not work.
Thank you,
ibok23
|
|
|
|
|
ibok23 wrote:
dim rollawaybed as double = 5
rollawaybedcharge.text = (rollawaybed * numberofdays.text)
Well, you're trying to multiply a Double (number) by a String (.Text). You can't do that. But what you can do is convert the String TO a number first:
Dim rollawaybed As Double = 5
Dim newcharge As Double = rollawaybed * Val(numberofdays.Text)
rollawaybedcharge.Text = Format(newcharge, "C")
Val will convert a string of numbers, like 5 or 5000 (NO PUNCTUATION!), into a actual value that can be used in calculations.
RageInTheMachine9532
|
|
|
|
|
I would like to have a datagrid that automatically 'Refreshes' the dataset every time a new record is entered into the sql database. When I run the update on the dataset, fill the datagrid and use the expand statement, it does not fill out the rows.
Any help / suggestions to achieving this is appreciated.
Thanks!
Bob Gronenthal
|
|
|
|
|
Can you show us your code piece ?
-----------------------------------------------------------
"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
|
|
|
|
|
This is the code as it stands right now...
'Updates the current dataset the datagrid is using
Me.SqlDAFire_Cur.Update(Me.DsFire_Cur1)
Me.SqlDAFire_Cur.Fill(Me.DsFire_Cur1)
'Rebind the datasource to the datagrid
Me.DataGridFire.DataSource = Nothing
Me.DataGridFire.DataSource = Me.DsFire_Cur1
Me.DataGridFire.Expand(-1)
It does not expand the entire datagrid with the records though and since I would like this automated I was thinking of putting this into a timer event.
Thanks,
Bob
|
|
|
|
|
Anybody know how to convert a colour picked from a colour picker or whatever into an HTML colour code?
Much Obliged!
|
|
|
|
|
colors are represented in long
so try this (VB6)
htmlColor = "#" & Hex(Color)
|
|
|
|
|
Would that work in .NET also? Thanks for the help.
|
|
|
|
|
I am having a problem while setting the startup object to sub-main,
even though inside the sub main i have loaded two forms that have their own
things to do,
to programs ends at the end of sub main,
so how do i keep it alive?
- Note: using a modal form (myForm.ShowDialog) is not an option as my project needs to switch focus between forms.
Fade (Amit BS)
|
|
|
|
|
Loading and showing two forms will not keep your app open. Since your sub Main ends, so does your app. Really, what you should be doing is starting your app with a Form, since the message pump in this form will not end, and therefore your app, until the pump recieves a WM_QUIT message.
What is the purpose of having a Sub Main in your app?
RageInTheMachine9532
|
|
|
|
|
Well, i know that using a form as a startup object will keep it alive,
the main reason to use a 'Sub Main' is to get command line arguments, and i find it more organized to create an instance of the main form through code.
So a. commandline arguments
and b. neet code.
any suggestions?
Fade (Amit BS)
|
|
|
|
|
Fade (Amit BS) wrote:
a. commandline attributes
You don't need a Sub Main for command line arguments.
In you Form_Load event, or something else close to your app starting up, just use Environment.GetCommandLineArgs() to get a String array of the arguments.
Fade (Amit BS) wrote:
b. neet code
But a pain in the butt to keep an app running. It's MUCH easier to just have a main form and have that form launch the others than it is to keep a Sub Main in a relatively infinite loop watching for and waiting for all the open forms, most of which it has no clue even exist, to be closed and unloaded.
Think about it. Pick any app in Windows, like Word, VS.NET... They all have a main form and a bunch of helper forms that the main form launches and manages.
RageInTheMachine9532
|
|
|
|
|
ok,
You win
the command line arguments solution has tilted it to your favour, especially when there is no easy 'right' way to keep the app running via sub main.
thanx, i'll go back to using a main form.
Fade (Amit BS)
|
|
|
|
|
Hi im trying to retrieve data using a listview but get the following error when running:
An unhandled exception of type 'System.Data.SqlTypes.SqlNullValueException' occurred in system.data.dll
Additional information: Data is Null. This method or property cannot be called on Null values.
My code is as follows:
listitems.subItems.Add(IIf(IsDBNull(.GetString(1)), .GetString(1), ""))
can someone please help
Chrissy Callen
|
|
|
|
|
Chrissy Callen wrote:
listitems.subItems.Add(IIf(IsDBNull(.GetString(1)), .GetString(1), ""))
This statement is sitting inside a 'With' block. It would help to know what that 'With' is.
The GetString Method is being executed on a record that doesn't have a value. What you should be checking for first is if there is a value there, then execute GetString on it. Your trying to see if GetString returns a NULL, and if true, return the GetString NULL, if false, return an Empty string.
What you should be doing is this:
IIF( expression, Object if expression True, Object if expression False ) As Object
listitems.subItems.Add( IIf( IsDBNull(<whatever'With'Is>), "", .GetString(1) ) )
RageInTheMachine9532
|
|
|
|
|
It has to do with the IIf statement. It evaluates both conditions, regardless of whether the first one is true or not. In other words, it does not short-circuit. You need to use the regular VB If-Else-End If construct to make this logic work the way you want.
|
|
|
|
|
Hi
First sorry because my english is not very good.
I am a vb.net beginner , later I work with Visual C++.May be my problem is funny or maybe the datagrid is not a standard tool to work with data(add,remove,update,...) but I really have lots of problem with it.
I want to design a form that user should enter many records and at a time see the previous and next records.This Table has many fields I think it must be easier for the user to enter some of the fields in the columns of the datagrid and some of it in the form(textbox,combo,..) below the datagrid. and also some of the datagrid should be like combo box and some of it textbox and some of it Timeformat.I can connect the datagrid to the base and read the data . but I have not any control on the DataGrid,for example set a special query or change the column appearance to combo box or Mask edit or tabbed from one row of the column to the fields of the form for entering another fields of the record.how can I do these?
Can I use Ado not ado.net with VB.Net dataGrid ? if I can use ado and set the columns of the datagrid to the ado recordset it's so better.if I can do it please tell me how?Thanks a lot
|
|
|
|
|
Other than Source Safe, what version control systems have you used? Also, did they integrate with VB6, VS.NET? We are a very small company, and the cost of source safe is a big hit for us. Is there anything cheaper, as stable, as integrated?
Thanks.
Nursey
|
|
|
|
|
I have used CVSNT (www.cvsnt.org) with the TortoiseCVS client for a few months. But during this week I've changed to Subversion (subversion.tigris.org) with the TortoiseSVN client.
CVS is an older system very well known for Unix users and CVSNT is the Windows version of that system. As for Subversion, is targeted to replace CVS in the next years and from what I have seen they have a very good chance of doing just that.
Both Tortoise clients work in the same way. They are integrated in Windows Explorer and with just a few clicks you can do whatever you want with them. There are more clients around but those are the ones I like the most.
Both systems and clients are 100% free and they have worked very well for me with WindowsXP and .NET projects. I haven't found a reliable client to use CVSNT or Subversion directly from the IDE. But still, I managed to work with them and they have helped me a lot.
I hope I helped.
|
|
|
|
|
Thanks screaver. That's a lot of good info.
I'm really looking for IDE integration though.
I found one called Code Co Op, which is a peer-peer source control system, so there is no server, and its about $160 (US). Which is a bit more affordable. I'm nervous about using freeware things for mission critical aspects of a business, because you can't really afford a come back on somebody that did you a favour, but cost you millions 8-)
Nursey
|
|
|
|
|
|
simple question, im sure its around here somewhere, just couldnt see it.
if someone could send a link to it, if nothing else, that would be great.
just wondering how to program my application so that it can load a file into the program once the file type is opened. say, a notepad program opening .txt files, or winamp opening .mp3s. how do you do this?
edit: i know how to open and read files etc etc, i dont need help there.. im just wondering how i can load the file automatically if it is opened with the program, or where i put the code to do this.
Thanks alot, advanced.
------------------------
Jordan.
III
|
|
|
|
|
First, you app must support command line arguments. You'll have to pick out an open command and the filename to open. Notepad is launched by a command line that looks like this:
C:\WINDOWS\system32\NOTEPAD.EXE C:\Fullpath\filename.txt
Second, check out how .TXT files are associated to Notepad. Open an Explorer window and go to Tools\Folder Options. Click on the File Types tab and scroll down to TXT. Click on it to select it, then click on Advanced. Edit the Open command and you'll see what I'm talking about as far as command lines.
RageInTheMachine9532
|
|
|
|