|
Tamimi - Code wrote: if my data base has the date format mm/dd/yyyy
Stop. Database's don't have a format for a date, unless you made the mistake of storing the date as text. Pass the date to a parameter in your SQL insert and you pass this parameter a DateTime value, not a String.
|
|
|
|
|
Dave Kreskowiak wrote: Stop. Database's don't have a format for a date,
in MS server i could enter a date 06/17/2007.
but i could not enter 17/06/2007 .
can we consider this a date format problem ??
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Nope. I call it a validation problem.
You're not putting the date entered by the user into a DateTime value. You're just taking the string and putting that directly into an SQL statement. That's a really bad idea.
If you use a parameterized query, the parameter will format the DateTime value for any SQL Server localization for you. All you have to do is get the text the user entered into a DateTime value, validate it so it's inside a good date range, then pass it to your SQL code.
|
|
|
|
|
If you are going to save the Date in the DB go with Datetime Format. not by String datatype.
In case if you have used the datatype as string then you should go with
Use the DateTime.ParseExact method to parse the string.
Regards,
Satips.
|
|
|
|
|
Wy are you getting this from a label? Why not just get the date/time value from the original variable that set the label's date? No conversion and no parsing will be involved then.
|
|
|
|
|
Hey,
I've drawn a drawing in form. For example I have drawn line or circle or ... My problem is I want to save this drawing as image file. Can anybody give me an idea how I can do this?
I appreciate your help.
hsprasain
|
|
|
|
|
Draw it onto an Image or Bitmap, then call it's Save method.
If you're already drawing in the Paint event, then just create a member Bitmap, draw onto that, and draw that in your Paint event.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
In my code I creat a piechart.
What I have done is stripped down the code to show you what goes where (This code will not work as it needs declarations and values...).
This code will in effect make the picture 'stick' to the form - so that it does not get erased as you move the form.
Panel1 is where the piechart is being drawn.
Width and Height are variables you need to set to the size of the picture you want.
You will also need to include the Panel1.CreateGraphics.DrawImage(b1, 0, 0) command in the Paint event of the objetct you are drawing onto - in fact this is where the magic of this method is...
Give this a go and good luck...
Regards
Guy
Cambridge
UK
Public b1 As Bitmap
Public g1 As Graphics
b1 = New Bitmap(Width, Height, Panel1.CreateGraphics())
g1 = Graphics.FromImage(b1)
g1.DrawPie(Pen:=myPen, rect:=New Rectangle _
(x:=x + XAdjust, y:=y + yAdjust, Width:=Width, Height:=Height), _
startAngle:=startPos, sweepAngle:=sweep)
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
Panel1.CreateGraphics.DrawImage(b1, 0, 0)
End Sub
You always pass failure on the way to success.
|
|
|
|
|
hi
i am very amator in vb.net i want build an editor program like notepad whit vb.net but i cannot build menu and their code like open in file submenu and save and ...
please guide me and help.
thanks a lot
|
|
|
|
|
Really, your best bet is to buy a book and work through it, or look for some tutorials online. Building a menu is simply a case of dragging it onto your form, and clicking where you want menu items to be, to add them. Making them do something is as simple as double clicking on them in the editor. The code is also fairly simple, just use the FileOpenDialog and FileSaveDialog classes.
But, again, if you're asking this, you're probaby enough of a beginner, that you really need to rely on a book to get you started, as you'll get more structured and consistent help than you cn get from forum replies.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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
i am very amator in vb.net programming i want build a editor program like notepad in vb.net but i cannot build menu and their code for menu like open frome file submenu and save and ...
please help and guid me
thanks a lot
|
|
|
|
|
Hi experts,
I need a vb script(.vbs) to convert a Excel file to Html file. Is it possible?????
Regards....Sagar
|
|
|
|
|
Of course it is possible. Anything is possible when you are programming!
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Iam creating a Text Editor and i have added a toolsrtip control in the form with 7 buttons on it . The size (height) of the toolstrip control is very small. so the buttons on it appear very small. I want them larger(both by length and breadth) and by default the size of the toolstrip control cannot be changed form the Properties window. Please kindly tell me how to change the size.
Aniket Sonawane
|
|
|
|
|
hello frnds,
how can i convert word document to XML using vb.net the
if any one have code or supportive link then plzz..help
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&EventID=1032319980&CountryCode=US
Try this video.
|
|
|
|
|
Can any one plz help me to get the code for my problem.
problem:
I have to generate tables at runtime from Ms Access data base. Number of tables to generate depends on the sql query we pass in the program and the depends on the data in the tables.
So I want the code for diplaying a table on control panel and fill the data to it from the Access files based on the query.
Plz reply me if you got any ideas or codes for this
thank you
dil
|
|
|
|
|
I have to generate tables at runtime from Ms Access data base. Number of tables to generate depends on the sql query we pass in the program and the depends on the data in the tables.
>> User the "create table ... " query statement to create the table with number of columns and their types.
So I want the code for diplaying a table on control panel and fill the data to it from the Access files based on the query.
>>Do you have any file, which holds datas for newly creating tables?
Be simple and Be sample.
|
|
|
|
|
Thanks for favourable answer "ramskr".
I am trying to generate the grid view table on the control panel through for loop by using the sql query.
I got the code to get the data from the Access data base.
So the thing I need is, code to generate table at run time
Cheers.
dil
|
|
|
|
|
how to get the date format in vb?
Jayesh Talsaniya
|
|
|
|
|
Do you need to extract, month, day, year from date?
use -> Date.month , Date.day, Date.year. Also you can convert date to shortdate, shorttime, longdate and longtime as string.
Be simple and Be sample.
|
|
|
|
|
no i dont mean that.
i want to check the format fo the date that is in the textbox contol.
wether it is dd/mm/yyyy or /mm/dd/yyyy or other....
Jayesh Talsaniya
|
|
|
|
|
In VB.net there is no direct control to check format. Try with masked text box. You have to write own code on keypress event - first 2 digit should be below 12 (if it is month) and so on.
Be simple and Be sample.
|
|
|
|
|
oh is it so?
k thanx for replying.
now i wil code for that.
regards
Jayesh Talsaniya
|
|
|
|
|
Unless you limit the input of the user, there's no way to tell what format the date is in, reliably. Think about it. Which number is the month and which is the day in "6/6/07"? With restricting the user to a known format, it's impossible to tell. You could get a good clue if you looked at the culture information though. Chances are, the entered date will follow the standard format for a country. Mostly... Check out the CultureInfo class. You can get the current culture your code is running under and get the DateTimeFormat from there. This would be the culture of the O/S is setup for, NOT necessarily the one the user typed into a TextBox.
|
|
|
|