|
Hi, Im try to create a simple program where user enter their name and password and it is then authenticated against database on a server that contains a table that stores username and password??? If anyone has an example that i can look at it would be great.
|
|
|
|
|
well this is just a matter of comparing 2 strings
dim suserdb as string = 'user string from the database
dim spassdb as string = 'pass string from the database
dim suser as string = 'user string from the form
dim spass as string = 'pass string from the form
if suser.equals(suserdb) and spass.equals(spassdb) then
messagebox.show("the user exist and the pass is correct")
else
messagebox.show("the user does not exist or the pass is not correct")
end if
suggestions:
-make user unique value in you're db
-when asking for the user in you'r sql check what you get returned if you don't have any row returned than the user doesn't exist
like this you can tell the user that his name doesn't exist
-only when user exists in db check if password is correct
|
|
|
|
|
Is there some part of the .NET framework that allows me to check to make sure a file is there?
To be more specific, I need to make sure a shortcut is there. Any ideas?
|
|
|
|
|
if system.io.file.exists(path as string) = true then<br />
'it exists<br />
end if
You can do the same with a directory.
|
|
|
|
|
Is there a way to navigate to the file you want to copy in code?
|
|
|
|
|
|
|
You'll have to explain what you mean by "automatically navigate to a file"??
|
|
|
|
|
In code, tell it to go to %USERPROFILE%\Desktop\. I am trying to put an icon on the desktop without using a special installer.
|
|
|
|
|
Environment.SpecialDirectory, from memory, is how you get paths to things like the desktop.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
List of special folders:
0 Desktop
2 Programs
5 Personal
6 Favorites
8 Recent
9 SendTo
11 StartMenu
13 MyMusic
16 DesktopDirectory
17 MyComputer
26 ApplicationData
28 LocalApplicationData
32 InternetCache
33 Cookies
34 History
35 CommonApplicationData
37 System
38 ProgramFiles
39 MyPictures
43 CommonProgramFiles
This will get you the user's desktop:
Environment.GetFolderPath(Environment.SpecialFolder.DeskTop)
|
|
|
|
|
Hi,
I need to do something similiar to:
I need to convert any random number, to text. How would I do this?
private function getDateFormat() as string<br />
Dim theDate as string = "01-06-2005 13:45:30"<br />
Dim theDateFormat as string = "dd-mm-yyyy hh:mm:ss"<br />
'need function here to convert to text, or something else?<br />
return "1st June 2005, Quarter-To-Two"<br />
End sub
|
|
|
|
|
what do you mean any number?!!
if you mean double single integer ,... you can use ToString method
for making your method work for all types simply use Object
like
<br />
Private Function ConvertToString(byval obj as Object)as string<br />
<br />
return obj.ToString()<br />
<br />
End Function<br />
and there is another way too use Convert.ToString method
but I have some doubt you wanted that when I look at your code!
|
|
|
|
|
A date is not a number.
You can use the DateTime.ParseExact method to parse your string into a DateTime value.
When you have the DateTime value, you can format it any way you like. There is no built-in format like "Quarter-To-Two", so you have to implement that yourself.
---
single minded; short sighted; long gone;
|
|
|
|
|
What you are askng is complex. There is no in built function in .net to return a given number as words. You would have to build a module and pass values to it, but this module would be very big and you would have to enter each word corresponding to a number manuelly.
|
|
|
|
|
I am trying to write an array of Bytes to a serial port. If I do the following code I can successfully communicate with the serial port.
Dim byteQuit() As Byte = {&H2, &H51, &H3, &H63, &H8D}
serialPort.Write(byteQuit, 0, byteQuit.Length)
But I want to bring in data and place it in the array. When I do this I get an error 'Out of Bounds Exception'
Dim arrayTemp(10) As String
Dim custByte() As Byte = {&H2, &H45, &H41, &H1, Byte.Parse(arrayTemp(0)), &H1, Byte.Parse(arrayTemp(1)), &H1, Byte.Parse(arrayTemp(3)), &H1, &H1, Byte.Parse(arrayTemp(2)), _
&H1, &H1, &H1, &H1, Byte.Parse(arrayTemp(9)), &H1, &H1, &H1, &H1, &H1, &H1, &H3}
It is obvious that I am doing something wrong with the data conversion. What is not obvious (at least to me, right now) is how to fix it. Granted, if I take the time I could probably figure it out (two weeks later). I was hoping one of you nice people would help me out.
Specifically, how to change arrayTemp() to each Hex character.
Thank you for your help.
|
|
|
|
|
Hi Cory,
obviously there is some code missing that sets the values of arrayTemp.
Just declaring an array, results in a lot of null references, not meaningful data.
Are you saying arrayTemp is holding hexadecimal strings ? if so, Byte.Parse will not
do it in that way ?
Or are you saying your code is an attempt to deal with hexadecimal ? If so, I don't
recognize any of it.
Anyway, I am puzzled by all these &H1 values in custByte().
And I would suggest you do the parsing in separate lines, with intermediate variables;
this would:
- make things more readable,
- allow you to see (even print) the values for inspection,
- allow exact pin-pointing of the exception.
Also please read and apply my sig (tips 1 and 2).
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I already searched articles and google with no result.
In answer to your questions:
arrayTemp holds strings (They don't need to be) like customer#, customer name etc.
To send through a serial port I have to create a frame. &H1 separates the segments of data. The data is hex characters. &H2 starts it and &H3 ends it.
I want to grab data from somewhere and place it in my custByte(). See original post.
EX: Convert the arrayTemp(0) = "1000" to it's hexidecimal equivalent = 31 30 30 30 \
Is there an easy way to do this? Or Hard? I just need to know how this can be done.
|
|
|
|
|
Hi Cory,
you are confusing hexadecimal with decimal, and binary with text.
also your sequence of &H1 does not fit the needs.
31 30 30 and 30, when taken as hex numbers are the values of the ASCII characters 1 0 0 and 0.
Hence you want to send the text string 1000 here. Your code does not do that at all.
So it sounds like you want to send a big string consisting of:
- maybe some initial characters or bytes indicating the start
- then for each field: a starting char or byte, followed by the string representing the value
- maybe some final characters or bytes indicating the end
If all chosen delimiters were printable characters, it would be a plain text application,
and you could solve it with string concatenation, then a single "write string".
If you really need non-printable chars/bytes in between the fields, you can go two ways:
- try to come up with a byte array that contains all; that's the hard way, which you are
attempting right now
- just issue a couple of SerialPort.Write methods, something like (pseudo-code !):
port.Write(aByteArrayIndicatingStart,0,itsLength) ' that is binary operation
for every field:
port.Write(aByteArrayIndicatingFieldSeparator,0,itsLength) ' that is binary operation
port.Write(field.ToString() ' that is text operation
port.Write(aByteArrayIndicatingEnd,0,itsLength) ' that is binary operation
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
How do I ping another computer?
Ross
|
|
|
|
|
There is a nice little Ping class for that...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
There is is 2.0 but not in 1.1 iirc.
|
|
|
|
|
correct.
Long time ago I did if for 1.0 with some 100 lines of code, using Socket.SendTo
and Socket.ReceiveFrom in a separate thread.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
System.Net.NetworkInformation.Ping
or
My.Computer.Network.Ping()
The second one only returns a boolean value whether or not the ping succeeded.
You'll have to tweak it a bit to make it work.
I made an app that does the same thing "ping Google.com" does in command prompt. I can get you the basics if you wish.
|
|
|
|
|
`Drew wrote: System.Net.NetworkInformation.Ping
well that's 2.0 also
`Drew wrote: My.Computer.Network.Ping()
I do almost everything using C#, and it does not have that nice My thingy.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|