|
Hi guys, i'm new in VB9 and i don't know how i can add API into my code! Where is APIs??????
Thanks
|
|
|
|
|
DigiMyth wrote: i don't know how i can add API into my code!
I presume you are referring to the Windows API. Search Google[^] and you will find plenty of information.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Basically im searching for "API Viewer" program like VB6.
One more question, is the VB.NET the same as VB9, or its different lang???
|
|
|
|
|
DigiMyth wrote: Basically im searching for "API Viewer" program like VB6.
P/Invoke.net[^] is a good source of information.
DigiMyth wrote: is the VB.NET the same as VB9, or its different lang???
VB9 is the latest version of VB.NET. This article[^] provides further explanation.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
hi.stil me again..ya..so funny...i can store login time..but can't update logout time..can help..?thanks
Dim Emp_IDDataRow As DataRow<br />
Dim Encryption As String<br />
Dim i As Integer<br />
Comdataset = Com.getCOMDataset<br />
Encryption = ""<br />
Emp_IDDataRow = Comdataset.EMPLOYEE_DETAIL.FindByEmp_ID(txtID.Text)<br />
<br />
If Emp_IDDataRow IsNot Nothing Then<br />
For i = 1 To Len(txtPass.Text)<br />
Encryption = Encryption & Chr(Asc(Mid(txtPass.Text, i, 1)) + 3)<br />
Next<br />
If txtPass.Text = Emp_IDDataRow!Password.ToString Then<br />
LoginTime = Format(Date.Now, "HH:mm:ss")<br />
strID = txtID.Text<br />
LoginDate = Format(Date.Today, "dd/MM/yyyy")<br />
Me.LOGIN_OUTTableAdapter.InsertLogin(LoginTime, strID, LoginDate)<br />
MessageBox.Show("Login Successful!", "infor", MessageBoxButtons.OK, MessageBoxIcon.Information)<br />
frmMenu.Show()<br />
<br />
If Encryption = Emp_IDDataRow!password.ToString And txtID.Text.ToUpper.StartsWith("TM") Then<br />
MessageBox.Show("Welcome, " & Emp_IDDataRow!name.ToString, "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)<br />
frmMenu.Show()<br />
ElseIf Encryption = Emp_IDDataRow!password.ToString And txtID.Text.ToUpper.StartsWith("LM") Then<br />
MessageBox.Show("Welcome, " & Emp_IDDataRow!name.ToString, "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)<br />
frmPurchase.Show()<br />
txtID.Focus()<br />
txtPass.Focus()<br />
txtID.SelectAll()<br />
txtPass.SelectAll()<br />
End If<br />
Else<br />
MessageBox.Show("Invalid Password", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error)<br />
txtID.Focus()<br />
txtPass.Focus()<br />
txtID.SelectAll()<br />
txtPass.SelectAll()<br />
End If<br />
Else<br />
MessageBox.Show("Invalid ID!", "ERROR", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error)<br />
txtID.Focus()<br />
txtPass.Focus()<br />
txtID.SelectAll()<br />
txtPass.SelectAll()<br />
End If<br />
<br />
End Sub
INSERT INTO LOGIN_OUT
(Time_login, Emp_ID, Logindate)
VALUES (?, ?, ?)
i set time login emp id and logindate as primary key
UPDATE LOGIN_OUT
SET Time_logout = ?
WHERE ('Time_login' = ?) AND ('Emp_ID' = ?) AND ('Logindate' = ?)
it add same column in Time_login but not in time_logout
|
|
|
|
|
This is nasty code.
Just do the same as you did for login, to store the logout. Surely it's going to work the same ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
no choice..this the code i only can think...mean the update i change to insert..?because when i login then go form 2...once i close form 2..automatically insert to time_out .in form 2 code that i wrote is
frmLogin.LOGIN_OUTTableAdapter.UpdateLogin(Format(Date.Now, "HH:mm:ss"), frmLogin.LoginTime, frmLogin.strID, frmLogin.LoginDate)
should i do the same thing with insert..?
|
|
|
|
|
I mean, you've written the code to store a date into the DB, so why not write the same sort of code here ? I know from watching the questions you ask that you've not understood my answers or done what I suggested, so I have no idea how you got the other one working, but it means you know how to insert a date, right ? I mean, if someone gave you code that works, you took the time to understand it, right ?
It doesn't matter if you're being paid for this code, or if you're a student ( except that if you're being paid, that is plain disgusting ), you should be taking the answers you get, and coming to an understanding of how they work, so you can become competent in your own right, instead of spending your life on these forums asking the same basic questions over and over.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
no..no..i know i'm asking nasty question..i stil student...code i wrote myself...not copying from others...sometimes easy things i go think hard way to do...okok..i do the same thing as do my login
|
|
|
|
|
OK - a lot of people ask these sort of questions for their work. If you're a student, then that's cool. You just plainly are not yet at a commerical level and a lot of people seem to get jobs anyhow
By all means, if you try to use the method you're using to insert the date on the login end, and you have a specific problem, feel free to post it here, but you should look at that code first, you should be able to reuse the date insert portion to insert a date again.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
ok thanks..very glad that you reply me all the nasty question..thanks..
|
|
|
|
|
but one problem i do the logout in formclosing...how do i do the query?
Private Sub frmMenu_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
frmLogin.LOGIN_OUTTableAdapter.UpdateLogin(Format(Date.Now, "HH:mm:ss"), frmLogin.LoginTime, frmLogin.strID, frmLogin.LoginDate)
End Sub
why when i close the form it store in login time..but not logout column...
UPDATE LOGIN_OUT
SET Time_logout = ?
WHERE ('Time_login' = ?) AND ('Emp_ID' = ?) AND ('Logindate' = ?)
modified on Saturday, April 12, 2008 8:56 AM
|
|
|
|
|
Well, for starters, are you sure the logindate and time of login you're passing in are correct ? I'd be inclined to suggest you can simplify this to where Emp_ID = ? and time_logout is null, or something to use the most recent login date. Also, the column names should not be in quotes.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
thanks can work d...UPDATE LOGIN_OUT
SET Time_logout = ?
WHERE ([Time_login] = ?) AND ([Emp_ID]= ?) AND ([Logindate] = ?)
i do with this
|
|
|
|
|
Glad to help. For the record, your questions are not nasty. We have a lot of people asking these sort of questions when they are working, and THAT is nasty. Perhaps try saying in future that you're a student in your posts, I think you are getting stuck in the fallout from a negative feeling towards people who have taken jobs they are not ready for. If you're a student, any question is valid, and that's what we're here for.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i think i written here before that just start my college life..and this is 1st assigment that i got ..it call selling and buying system...many thing i learn in college but there is more thing i did't not learn..this time is problem is how do i do calculation in vb and database..
|
|
|
|
|
hi, i try to make the database to be updated with .addnew,.update function in the array below. but there was an error.as the below coding, i haven't make any changes to makesure the database be updated as the new data entered.help me. . for information. this is about interconnected within two forms, that is main form, and addnew projects form.
'this is a part of the main form to display the projects
Public Sub Display_The_Projects()
Dim intCounter As Integer
Dim intCounter_2 As Integer
Dim intCounter_Outside As Integer
Dim Date_In As Date
Static blnNot_First_Time As Boolean
'blnNot_First_Time = False
' Initial Array Assignments
If blnNot_First_Time = False Then
datTo_Do.Recordset.MoveFirst
intCounter = 1
intCounter_2 = datTo_Do.Recordset!Tab_Number
Do Until datTo_Do.Recordset.EOF
If intCounter_2 <> datTo_Do.Recordset!Tab_Number Then
intCounter = 1
intCounter_2 = datTo_Do.Recordset!Tab_Number
End If
gstrTo_Do_Array(datTo_Do.Recordset!Tab_Number + 1, intCounter, 1) =
datTo_Do.Recordset!comment
If datTo_Do.Recordset!Code = "A" Then
gstrTo_Do_Array(datTo_Do.Recordset!Tab_Number + 1, intCounter, 2) = "Active"
ElseIf datTo_Do.Recordset!Code = "R" Then
gstrTo_Do_Array(datTo_Do.Recordset!Tab_Number + 1, intCounter, 2) = "Reactive"
End If
gdtmTo_Do_Dates(datTo_Do.Recordset!Tab_Number + 1, intCounter, 1) =
datTo_Do.Recordset!Date_Entered
gdtmTo_Do_Dates(datTo_Do.Recordset!Tab_Number + 1, intCounter, 2) =
datTo_Do.Recordset!Date_Due
intCounter = intCounter + 1
datTo_Do.Recordset.MoveNext
blnNot_First_Time = True
Loop
End If
Date_In = #9/23/1999#
For intCounter_Outside = 1 To 6
picTo_Do(intCounter_Outside).Cls ' Clear the picture box
For intCounter = 1 To 12 ' Set the color and print the project
If gstrTo_Do_Array(intCounter_Outside, intCounter, 1) > "" Then
If gdtmTo_Do_Dates(intCounter_Outside, intCounter, 2) < Date_In Then
picTo_Do(intCounter_Outside).ForeColor = vbRed
ElseIf gstrTo_Do_Array(intCounter_Outside, intCounter, 2) = "Active" Then
picTo_Do(intCounter_Outside).ForeColor = vbBlack
Else
picTo_Do(intCounter_Outside).ForeColor = vbMagenta
End If
' Position the cursor then Print the project
picTo_Do(intCounter_Outside).CurrentX = 50
picTo_Do(intCounter_Outside).CurrentY = (intCounter - 1) * 300 + 40
picTo_Do(intCounter_Outside).Print gstrTo_Do_Array(intCounter_Outside, intCounter, 1)
End If
Next intCounter
Next intCounter_Outside
End Sub
'this the the addnew project form
Private Sub cmdCancel_button_Click()
Unload frmAdd_To_Do
End Sub
Private Sub cmdOk_Button_Click()
Dim intCounter As Integer
Dim intPriority As Integer
' Determine the Priority
For intCounter = 1 To 5
If optTo_Do_Priorities(intCounter).Value = True Then
intPriority = intCounter
End If
Next intCounter
' Find the first empty spot in the array
intCounter = 1
Do While gstrTo_Do_Array(intPriority, intCounter, 1) <> "" And intCounter < 12
intCounter = intCounter + 1
Loop
' Put data in the array
gstrTo_Do_Array(intPriority, intCounter, 1) = txtTo_Do_Description
gstrTo_Do_Array(intPriority, intCounter, 2) = "Active"
gdtmTo_Do_Dates(intPriority, intCounter, 1) = Date
gdtmTo_Do_Dates(intPriority, intCounter, 2) = txtDue_Date
Unload frmAdd_To_Do
End Sub
*the problem is im in problem to make it as .addnew, .update, to make sure any added projects is updated in database.plz give me some idea.
modified on Saturday, April 12, 2008 4:12 AM
|
|
|
|
|
I don't see any database code, but if the problem is getting the main form in sync with what happens in a child form, use delegates to call methods on your main form when things happen on the child form.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
yes, i havent add any database code, since that is my problem. because i got a problem to add database code in array in a child form.i hope this will be more clear.tq so much
when i put .addnew, .update function to make sure my database is updated when the new info is added
' Put data in the array
'this is the first coding before database coding is added
gstrTo_Do_Array(intPriority, intCounter, 1) = txtTo_Do_Description
gstrTo_Do_Array(intPriority, intCounter, 2) = "Active"
gdtmTo_Do_Dates(intPriority, intCounter, 1) = Date
gdtmTo_Do_Dates(intPriority, intCounter, 2) = txtDue_Date
'this is the new coding with the database code
'but it doesnt work
gstrTo_Do_Array(intPriority, intCounter, 1) = txtTo_Do_Description
datTo_Do.Recordset.Addnew
datTo_Do.Recordset.Field("Comment")=txtTo_Do_Description
datTo_Do.Recordset.Update
gstrTo_Do_Array(intPriority, intCounter, 2) = "Active"
datTo_Do.Recordset.Addnew
datTo_Do.Recordset.Field("Code")="Active"
datTo_Do.Recordset.Update
gdtmTo_Do_Dates(intPriority, intCounter, 1) = Date
gdtmTo_Do_Dates(intPriority, intCounter, 2) = txtDue_Date
datTo_Do.Recordset.Addnew
datTo_Do.Recordset.Field("Date_Due")=txtDue_Date
datTo_Do.Recordset.Update
modified on Saturday, April 12, 2008 10:20 AM
|
|
|
|
|
inderabangsawan wrote: datTo_Do.Recordset.Addnew
datTo_Do.Recordset.Field("Comment")=txtTo_Do_Description
You called AddNew , but then completely ignored the record object returned from it. You're not making any changes to the new record at all, you've just added a blank record to the dataset.
|
|
|
|
|
hi all
i have developed an application in vb.net with mssql express. now i wants to handle my users, when a user wants to handle logout or logoff and switch over to new login, i mean to say before logout or logoff i want ot close all opened forms in the curret session.
pl help me to handle it.
thanks
rmshah
Developer
|
|
|
|
|
How you do this depends on the design of the application.
Either, your application should be tracking all of it's open forms, probably in a collection, so that it can close them all when needed, or if there is a chain of forms open, the user should be forced to close or cancel all open forms in order to get back to the main form.
Putting the logout option deep inside your app is not a correct design choice.
|
|
|
|
|
hai friends
i have a problem in access Ms-access database table..
for the database , i set a password...
and i written the following code to access it ....
Try
Dim con As New OleDbConnection("Provider=Microsoft.JET.OleDb.4.0;User Id=administrator;Password=xyz;Data Source=D:/DataBase/Master.mdb")
Dim da As New OleDbDataAdapter("select * from login", con)
Dim ds As New DataSet
da.Fill(ds, "login")
DataGridView1.DataSource = ds
Catch ex As Exception
MessageBox.Show(ex.Message, "database")
End Try
but it is giving the error like ...
Cannot start your application. The workgroup information file is missing or opened exclusively by another user.
then i closed all the files , even i restarted the system ....
but it is giving the error...
wt would be the problem ....
either in setting the password for the database
or in vb.net ( in the above code )
plz help me....
thanks in advance
vijay
|
|
|
|
|
try this code
I think this will work
' your connection string will be
Provider=Microsoft.Jet.OLEDB.4.0;Data Source = D:/DataBase/Master.mdb ; Persist Security Info=True ;Jet OLEDB:Database Password=xyz"
|
|
|
|
|
Reverse the slashes in your connection string. Forward slashes are for command line parameters. Backslashes (\) are for file path names.
Your Access database has either has a database password or workgroup security setup on it. You can find the connection string format for this at http://www.connectionstrings.com[^]. You're using OLEDB (.NET). Do not use the ODBC versions!
If you have workgroup security, you have to specify the databases .MDW file in the string along with the database filename.
|
|
|
|
|