|
HI guys, I'm a student and need some help with dates in VB.NET. What do I do to verify that date values are input correctly on a form? This includes the following: The day, month and year are entered separately; One cannot (obviously!) be born on day 0 of month 13, or on 29 February 2003. I've never worked with dates and don't know how to go about this. Can someone please help me here?
MichMar
|
|
|
|
|
With the day, month and year being inserted separately ... it can be easy to check.
some normal logic
You will ask the year first because of leap years and stuff.
Next the month will be enetered in
if EnteredMonth > 0 and EnteredMonth < 13 then<br />
'month is a correct month<br />
else<br />
'month is not correct<br />
end if
then when u know the month you can demine if the month has 30/31/28 or 29 days and the day can be checked to see if it falls in the bounds
here is just a basic layout that you can change to suit your variables ect .. i think that more than explains it how i would go about it
<br />
if year = leapyear then<br />
<br />
<br />
else ' not a leap year<br />
if month = 4 or month = 6 the 'all the months that have 30 days<br />
if enteredday > 0 and enteredday < 31 then<br />
'date is correct<br />
else <br />
'error <br />
end if<br />
end if<br />
<br />
if month = 5 or month = 3 then 'all the months that have 31 days<br />
if enteredday > 0 and enteredday < 32 then<br />
'date is correct<br />
else <br />
'error <br />
end if<br />
<br />
if month = 2 then 'month is feburary<br />
end if<br />
<br />
end if<br />
<br />
end if
|
|
|
|
|
use a datetimepicker control
GUERVEN
Truth or Consequence
|
|
|
|
|
hi there, I wonder if someone know an easy way to tarnish a given rgb color. (decrease the saturation)
I can't find working convertion algorithms between RGB <-> HSL
thanks in advance for your help !
|
|
|
|
|
Where did you look ? The one in the C# section in my article on HSL works fine.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi Christian,
it's a nice source you provided
All I need is this, am I right ? :
HSL hsl = HSL.FromRGB(bytesSrc[2], bytesSrc[1], bytesSrc[0]);
hsl.Saturation *= factor;<br />
Color c = hsl.RGB;
Gonna try that ! thanks
|
|
|
|
|
Yep, that looks right.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
That works like a charm !!
I made a DLL with only your C# class HSL and then I typed this in VB.Net :
Dim dlg As New ColorDialog<br />
If dlg.ShowDialog() = DialogResult.OK Then<br />
Label1.BackColor = dlg.Color<br />
Dim theHsl As HSL.HSL = HSL.HSL.FromRGB(dlg.Color)<br />
theHsl.Saturation -= 0.6<br />
Label2.BackColor = Color.FromArgb(theHsl.RGB.ToArgb)<br />
End If
That's all I needed, problem solved !! thanks a lot
|
|
|
|
|
Hello.
I writing some vb ( using vb 6 ) application and in some place i need to show some window on the top of all other windows.
The other windows are working in different application and i don't have any connection with them.
How can i be sure that my window in really will be on top ? i always find some place that the other window show their windows on me - so my window is not on top.
Thanks for any help.
|
|
|
|
|
For the top of all window, You must open your window as modal window. In modal window, No window comes on top unless your window have been closed.
form1.show vbmodal
Kumar Prabhakar
|
|
|
|
|
I'm using Nemanja's Task Pane project and I have all the panels laid out the way I need them and I'd like to add click events to the items in each panel. Could someone tell me or show me how to do this?
Thanks,
Andy
P.S. It's way too much code to post here and I don't see how to attach a file here, so here's the link to Nemanja's project. http://www.codeproject.com/useritems/TaskPane_Source_Works.asp[^]
|
|
|
|
|
Hi,
I am developing a Multithreaded Application for Scanning using Black ICE Imaging SDK. In one Primary Thread I am scanning Images and saving them to collection. In Second Thread, I am doing Image processing on the scanned Image by taking it from Collection.
My Problem is the Primary thread is scanning Images, but in Secondary thread when I try to load it from temporary file or Collection, I am getting some Exceptions. The brief Code for this is given below:
Sub StartScan( )
BiTwain.Action = BITWAINLib.enumScanOperations.TWSTAT_BATCHSCAN
Dim thrd as Thread
Thrd=new Thread(AddressOf ProcessImage)
Thrs.Start()
End Sub
Sub BatchPageDone( )
BIDIBObj.SaveDIBInImageFormatExt("C:\Temp\” & TempCount & “.tif", hDib, 1,
BIDIBLib.enumFileFormats.imgffTiff,
BIDIBLib.enumCompressionModes.imgcmCcittG4, BIDIBLib.enumFillOrderModes.imgfoNormal,
False)
TempCollection.Add(("C:\Temp\” & TempCount & “.tif")
End Sub
Sub ProcessImage( )
While TempCollection.Count = 0
Thread.CurrentThread.Sleep(100)
End While
'Loading Image to Memory
'I am geting error at this point
Hdib=BITiffobj.LoadTiffIntoDIB(TempCollection.Item(0).ToString(), 0, False)
'Processing HDib
End Sub
When the Secondary thread try to Load the Image from file, I am getting two errors. While trying to load First time, the Exception is “Request Timed out”. When try to load second time, the exception is “Because this evaluation could cause side effects, it will not be executed until enabled by user.”
Thanx,
.Net Programmer, Software Engineer
|
|
|
|
|
Dim thrd as Thread
Thrd=new Thread(AddressOf ProcessImage)
Thrs.Start()
Is this your actual code? Should be Thrd.Start() instead of Thrs.Start()
|
|
|
|
|
Sorry, It's a typing mistake.
It is Thrd.Start()
.Net Programmer, Software Engineer
|
|
|
|
|
Visual Basic 2005 Express Edition:
This works, but, I need to get the .wav file from Resources:
My.Computer.Audio.Play("C:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\OrthoLabRx\OrthoLabRx\Resources\PodVwBy.wav")
I placed the .wav file in Resources, but, I can't seem to access it from there.
This does not work:
My.Computer.Audio.Play(My.Resources.PodVwBy)
It says "value of type 'System.IO.UnmangedMemoryStream' cannot be converted to 'String'.
This worked, but, instead of a click, it played a grinding noise:
Dim sndPing As New SoundPlayer(My.Resources.PodVwBy)
sndPing.Play()
My.Computer.Audio.Play(My.Resources.PodVwBy)
|
|
|
|
|
I have an application that I wrote that causes a variety of message boxes to come up. Can somone here help me with how to make the message box color change.
Thanks
|
|
|
|
|
What part of the message box change color ?
If you are talking about the actual form part i dont think you can do that... On the other hand you could create your own custom message box which you could do that with
|
|
|
|
|
How do you create a custom message box?
|
|
|
|
|
hi all
Dim openFile As New System.Windows.Forms.OpenFileDialog
openFile.DefaultExt = "txt"
openFile.Filter = "All File(*.*) |*.*"
openFile.ShowDialog()
i wante to give me multi choices pdf and doc and jpeg
can u give me anther codes coz this program shoud be a one choice (all file)
merci
|
|
|
|
|
hi all
Dim openFile As New System.Windows.Forms.OpenFileDialog
openFile.DefaultExt = "txt"
openFile.Filter = "All File(*.*) |*.*"
openFile.ShowDialog()
i wante to give me multi choices pdf and doc and jpeg
openFile.Filter = "adobe(pdf) |document(doc)|jpeg(jpg)"
this code is error
give me the right code please
|
|
|
|
|
Please write a descriptive subject. The subject "help me" provides no useful information what so ever.
What do you mean when you say that the code "is error"? Do you get an error message? Doesn't it do what you expected, and if so, what did you expect and what happens?
Follow the pattern in the code you have; a description followed by a file mask.
---
b { font-weight: normal; }
|
|
|
|
|
Not that hard
openFile.Filter = "adobe(*.pdf) |*.pdf|document(*.doc) |*.doc|jpeg(*.jpg) |*.jpg"
|
|
|
|
|
"adobe(pdf)|*.pdf |document(doc)|*.doc|jpeg(jpg)|*.jpg"
Each pairing is | delimited eg. "type_HumanReadable|FileSystemMask".
then each pair is futher delimited by a pipe eg. "adobe(pdf)|*.pdf |document(doc)|*.doc"
also watch out for .jpeg s
I think you can add ", *.jpeg" to the end, but I can't quite recall off the top of my head.
oh and the other had some good points. look over his/her post.
next time just highlight "Openfile.Filter" and hit F1 to look at the help doc. I have to look this one up every time...
hey...slang is the vernacular for the vernacular...wow
|
|
|
|
|
hi, can someone tell me how to insert a new record. i have 2 values and i want them to be saved in the database. i have the username and password. all i want to do is to make the user fill the textfields and the values will be saved in the database. can someone help me pls with this??
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
ADY007 wrote: To insert a new record in asp.net
It is ADO.NET that is the part of the .NET Framework that deals with databases. ASP.NET is the part of the .NET Framework that deals with web applications.
ADY007 wrote: can someone tell me how to insert a new record. i have 2 values and i want them to be saved in the database.
There are many ways to insert data into the database here is one:
Dim conn As SqlConnection = New SqlConnection(connectionString)
Dim cmd As SqlCommand = New SqlCommand()
cmd.CommandText = "INSERT MyTable(Column1, Column2) VALUES (@value1, @value2)"
cmd.Parameters.Add("@value1", firstValue)
cmd.Parameters.Add("@value2", secondValue)
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
Assumptions:
* You are using SQL Server
* You have a connection string already called connectionString
* You have a table called MyTable
* MyTable has two columns called Column1 and Column2
* The values you wish to insert are stored in variables called firstValue and secondValue
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|