|
If I didn't know any better, I would think this is part of a scam.
Where you from?
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
You seem to be copying and pasting code together, knowing nothing about the code you're using, hoping the frankenstein assemblage you're building works.
True?
|
|
|
|
|
|
I think SQL injection is the least of his problems
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
VB6 is no longer supported, and no new code should be written in the language. The compiler isn't sold anymore, and there's no OS for sale that still supports it.
There's several problems with your code, SQL-injection just being one of them. You're also storing passwords, which is a security issue.
If you want to learn to code then upgrade to VB.NET; if this is part of a course or schoolwork, then I suggest you demand your money back.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Thanks for your response, I am on the verge of upgrading to VB.net. However I need to complete this project. If you still have an idea on how to generate this in VB 6. I will very much appreciate. Thanks
|
|
|
|
|
Your solution is insecure, in an unsupported language. I oppose both the use of VB6 (a waste of your clients time and money) and the way you're implementing it.
Just hardcode a general password in that form and be done with it. If you don't take it seriously, then why should I?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
How can I display automatically the username of a user that login to a Visual basic 6.0 application on the form
|
|
|
|
|
NOTHING happens "automatically". You either write the code to do it or it doesn't happen.
Are you prompting the user for a username and password to login to the app? If so, you already have the username is a string somewhere, so pass that to a method that sets the text of a label somewhere, or whatever control you're going to use to show the username.
|
|
|
|
|
So how do i pass that to a method that sets the text (user name) of a label on a particular form. Kindly assist with the right code to use on the vb6 form
|
|
|
|
|
Ummm... you're asking about how to do the simplest things in VB.
You mean to tell me you seriously don't know how to pass a string to a Sub or Function?
Do you even have a label on your form for showing the username?
Do you even have some Sub for setting the text of that label?
|
|
|
|
|
Please I will like to know if this code written is okay. seems to be having error. The aim is to prevent user from making any changes on form after saving.
CUSTOMER RESERVATION BILLLING (cmdSave, Command2)
If cmdSave.Caption = "Save" Then
Adodc1.Recordset.AddNew
txt.SetFocus
'Disenablebuttons
cmdsave.Enabled = True
cmdAddNew.Caption = "Cancel"
cboClassofRoom.Locked = False
txtCustomer_Name.Locked = False
txtRoomNo.Locked = False
txtCustomer_Address.Locked = False
txtPhone_number.Locked = False
txtAmountPaid.Locked = False
txtCheckin.Locked = False
txtDuration.Locked = False
txtDate.Locked = False
txtReceptionist.Locked = False
Else
Adodc1.Recordset.CancelUpdate
cmdsave.Enabled = False
cmdAdd.Caption = "Add"
'enablebuttons
cboClassofRoom.Locked = True
txtCustomer_Name.Locked = True
txtRoomNo.Locked = True
txtCustomer_Address.Locked = True
txtPhone_number.Locked = True
txtAmountPaid.Locked = True
txtCheckin.Locked = True
txtDuration.Locked = True
txtDate.Locked = True
txtReceptionist.Locked = True
End IF
End Sub
|
|
|
|
|
Seriously? Did you even read your code?
cmdsave.Enabled = True ??????????
|
|
|
|
|
|
Please how can I disable a Save button after a user submits a form, the aim is to prevent user from modifying any changes after saving on the form in visual basic 6.0.
Same with Print button, after a user prints a form, how can i disable the form so the user cannot print that particular form on the same visual basic 6.0.
I will be so grateful for you response.
Damian
|
|
|
|
|
- Stop using VB6 - it has not been supported for over 10 years
- If you have to use VB6 you can disable a button by setting its enabled property to false
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Thanks for the response. Meanwhile I am trying to upgrade to VB.net Pending when I wish to still ask based on your response.
How do I write the VB code to set its enabled property to false only after saving/printing a form. The aim is to prevent user from modifying or printing same form.
Thanks in advance
|
|
|
|
|
No, you disable the button BEFORE your code to save it or print it.
mySaveButton.Enabled = False
But, keep in mind that your code will not be able to stop a user from hitting the PrtScn button, pasting the screen shot into paint and printing it from there.
|
|
|
|
|
Assuming your buttons are called btnPrint and btnSave, in their click events add the line
btnPrint.enabled = False
or
btnSave.enabled = False
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
I am getting this exception for line 245:
For i As Integer = 0 To srno.Length - 1
Dim ins2 As String = "INSERT INTO purchase_bill_items VALUES('" & entry_no & "', '" & srno(i) & "', '" & item_name(i).ToString & "', '" & batch(i) & "', '" & exp(i) & "', '" & mrp(i) & "', '" & qty(i) & "', '" & unit(i) & "', '" & purchase_rate(i) & "', '" & discount(i) & "', '" & amount(i) & "')"
cmd.CommandText = ins2
cmd.ExecuteNonQuery()
Dim ins3 As String = "INSERT INTO item_stock VALUES('" & entry_no & "', '" & batch(i) & "', '" & item_name(i).ToString & "', '" & exp(i) & "', '" & qty(i) & "', '" & mrp(i) & "', '" & qty(i) * mrp(i) & "')"
cmd.CommandText = ins3
cmd.ExecuteNonQuery()
MsgBox(item_name(i))
Next
Help please!
|
|
|
|
|
One of the objects that you are concatenating has 'nothing' in it. Have you looked at
each object reference at index(i) to see what it contains? As a test you could concatenate
each object individually to see what object is causing the problem.
Dim ins2 as string = "INSERT...."
ins2 += entry_no
ins2 += "', '"
ins2 += srno(i)
...
|
|
|
|
|
|
Once you find which item is causing the problem, you can put in a check. I use a function such as NumNull(exp(i)) or StrNull(item_name(i) . Here are the functions:
Function NumNull(Number As Object) As Object
If Number IsNot DBNull.Value Then
NumNull = Number
Else
NumNull = 0
End If
End Function
Function StrNull(Str As Object) As Object
If Str IsNot DBNull.Value Then
StrNull = Str
Else
StrNull = ""
End If
End Function
|
|
|
|
|
Hi All.
I have a User form in Excell VBA. It have many control such as textbox, check, combobox.....
And I want to use tab to change from this control to another control in the form.
I have done
-set Tabstop of all the control to true
- Set tabindex for all control in the right order.
But I can't swich between control. Please help
|
|
|
|