Jx_Man 987 Nearly a Senior Poster Featured Poster

actually, put your code in all exepense textboxes key down event (cause user can change them all as they want).

Jx_Man 987 Nearly a Senior Poster Featured Poster

i have too many tasks this week and today is crowded day..
even for taking my lunch time (actually, i forgot to have a lunch :(), so i try to reply questions without testing.. ;) and forget some basic things..

Jx_Man 987 Nearly a Senior Poster Featured Poster

@Andre,,right,,i forgot to move a new label for they new location

Jx_Man 987 Nearly a Senior Poster Featured Poster

>>You can, just with a lot of code....
hehe..i mean its not working with change a style..but can do it API..;)

Jx_Man 987 Nearly a Senior Poster Featured Poster

its so strange that i have uploaded my project to show you what iam doing and you are still asking to show you my effort???... what exactly i want to know is iam making the sale form, it allows to enter the Amount and expenses which is ok ,now i want that it show the Total expense and then it subtract the total expense from actual amount..
This is why i have uploaded the project to let you know what i want..
just have a look at interface there are 2 text boxes below data grid .
1. is Total Expense ,and second is Remaining Amount .i want this to show data here.

its not about your project but your Effort on your Question..and it not showing on your project...
this an example, modified as u needed..

TextboxTotalExpense.text = val(textboxExpense1.text) + val(textboxExpense2.text) + .... + val(textboxExpense8.text)
TextboxRemainAmount.Text = Val(TextBoxAmount.Text) - val(TextboxTotalExpense.text)

place it on any event that you want.

Jx_Man 987 Nearly a Senior Poster Featured Poster

so what do you want?
showing next record and previous record its how move next and previous works.

Jx_Man 987 Nearly a Senior Poster Featured Poster

>>i know how to use update statment...thanz help me...
your post is not answer my question..

Jx_Man 987 Nearly a Senior Poster Featured Poster

your parameter is missing on line 56 Set lbl = Me.Controls.Add("forms.label.l") and also your top, left and width is too small for label, don't forget for m_memo value from user input..

For i = 0 To m_equation
     
         Set lbl = Me.Controls.Add("vb.label","Label" & i) 
            With lbl
             .Top = 1000 ' 10 too small
             .Left = 1000 ' 5 too small
             .Height = m_memo ' user input??
             .Width = 1200 ' 40 too small
             .BackColor = &HFF&
             .ForeColor = &H8000&
             .Caption = "lbl" + (i)
             .Visible = True
   End With
Jx_Man 987 Nearly a Senior Poster Featured Poster

and don't upload entire project just post your code which it relevant with your question

Jx_Man 987 Nearly a Senior Poster Featured Poster

your post is not clear..
also show your effort..

Jx_Man 987 Nearly a Senior Poster Featured Poster

@Das - Thanks,

Jx, tsk, tsk, :). Lets get them to show some effort first dude.;)

sometimes i think they've got a lot effort..:), but i still wrong this time ;)

@critznikkian, you can search on google for ascii table if u didn't sure about ascii code :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

hmm..so what the question here?

Jx_Man 987 Nearly a Senior Poster Featured Poster

i can't give u a code..because i don't know about your code..
what type of database connection? adodb? oledb?
actually how far you doing this..

Jx_Man 987 Nearly a Senior Poster Featured Poster

try this :

Private Sub Form_KeyPress(KeyAscii As Integer)
MsgBox KeyAscii
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

application.StartupPath refers to debug folder..
what the result of your startup execution?
if you feel hard to use application.startup then write your current address manually.
ex :

con.ConnectionString = ("Provider = Microsoft.JET.OLEDB.4.0;Data Source=C:\Documents and Settings\Ichigo\My Documents\Visual Studio 2008\Projects\WindowsApplication1\WindowsApplication1\bin\Debug\mydatabase.mdb")
Jx_Man 987 Nearly a Senior Poster Featured Poster

actually i become confused with all your posts..
if you want to Reset Password then all you need is UPDATE PASSWORD..don't delete it..
you just change the password of current user..
UPDATE record is different with ADD NEW Record.
so you don't have to Delete password or Insert new password just UPDATE new password.
You can use UPDATE Statment..

Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster

not working?
can u tell where u put database file?
i mean the path of it..

Jx_Man 987 Nearly a Senior Poster Featured Poster

still not clear..where is your code? i even didn't know what type of database connection you're using to connected.
your program is 90% completed. so, binding data is not hard to you.
how to bind it? just select the field that you want to display on combobox, read data until the last record and finish.

this following code using oledb..modified as u needed.

Private Sub ReadData()
        Dim con As New OleDb.OleDbConnection
        Dim cmdAuthor As New OleDb.OleDbCommand
        Dim dsAuthor As New DataSet
        Dim daAuthor As New OleDb.OleDbDataAdapter
        Dim dtAuthor As New DataTable
        Dim i, k As Integer

        ' Got the debug path
        con.ConnectionString = ("Provider = Microsoft.JET.OLEDB.4.0;Data Source=" & Application.StartupPath & "\Authors.mdb")
        Try

            cmdAuthor = con.CreateCommand
            cmdAuthor.CommandText = "SELECT * FROM Authors "
            daAuthor.SelectCommand = cmdAuthor
            daAuthor.Fill(dsAuthor, "Authors")
            dtAuthor = dsAuthor.Tables("Authors")
            For i = 0 To dtAuthor.Rows.Count - 1
                cmbAuthor.Items.Add(dtAuthor.Rows(i).Item(1))
            Next

        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Connection Error !!")
        End Try
        con.Close()
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

ok..i understand now.
then how far you doing this?
post your reset code in form2.

Jx_Man 987 Nearly a Senior Poster Featured Poster

try to check on immediate window. after running program, u can see this window on the buttom of vb6.

Jx_Man 987 Nearly a Senior Poster Featured Poster

you're welcome..
and don't forget to mark this thread as solved.

Jx_Man 987 Nearly a Senior Poster Featured Poster

change the style to Graphical (as WaltP suggest). Com.Style = 1 but this property is read only..you can't change at the run time.
so, you can't do that.

Jx_Man 987 Nearly a Senior Poster Featured Poster

then mark as solved.

Jx_Man 987 Nearly a Senior Poster Featured Poster

what are you used to connect? adodb?oledb?adodc control?
also post your code..show some effort first..how far u doing this..

Jx_Man 987 Nearly a Senior Poster Featured Poster

>>and as i already told u, it is not erroring when i m adding the record, but when navigating the record...
so,when you telling this?? you concern us with your adding codes from the start..
just post your navigate code and provides a full info about error..what an error came up, which line, etc.. so we can fully understand the problem..

Jx_Man 987 Nearly a Senior Poster Featured Poster

.NET Combo Box or list box doesn't support item data. You can create your own class if you want to keep using SetItemData.

Jx_Man 987 Nearly a Senior Poster Featured Poster

wow..its realy unsecured. that mean anybody can access a program.
say, if andre has already registered as user then every you open the program, he directly enter without login. so, what about another user open this program?
another user can directly access program too..

i suggest to load a user name and display it when user type a user name, but not the password.

Jx_Man 987 Nearly a Senior Poster Featured Poster

i've tried the similiar code. it running nicely.
as we said to you to change data type in database field in mssql server.
and maybe u need to convert an input to numeric type before add it to database.

Jx_Man 987 Nearly a Senior Poster Featured Poster

what your code in vb6 for vb6.Setitemdata?

Jx_Man 987 Nearly a Senior Poster Featured Poster

what error said?
in which line?

Jx_Man 987 Nearly a Senior Poster Featured Poster

it can happen if your database connection is error or you used a static path, so when you the code running in other computer this error can occurred or a data type problem like andreRet post.

Jx_Man 987 Nearly a Senior Poster Featured Poster

you must to change data type on database..
also i want to know which line of your code that error came up...
about text box input, you can set text box to not allowed an input except a numeric input. so text box just accept a numeric input.

Private Sub Text7_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
        Case 48 To 57, 8
        'Let these key codes pass through
        Case Else
        'All others get trapped
        KeyAscii = 0
    End Select
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

just save the path. usually as u save other records.
use a string data type..
when you load the path from database then u can show it in picture box.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Andreret : absolutely right..

Jx_Man 987 Nearly a Senior Poster Featured Poster

sorry for missing the file..my bad..
i still posting to you even this thread already solved :)
Good luck with your project.

Jx_Man 987 Nearly a Senior Poster Featured Poster

@AndreRet : this post will answered all his thread..haha..
you really in good mood friend :)

@Jaseem Ahmed : you really lucky today..so try it..don't say that u still confuse after andre write this much codes..good luck with your project :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

this following is an example code, modified as you needed.

Private Sub Add_Click()
    Adodc1.Refresh
    Adodc1.Recordset.AddNew
    Adodc1.Recordset.Fields("Au_Id") = Text1.Text
    Adodc1.Recordset.Fields("Author") = Text2.Text
    Adodc1.Recordset.Fields("YearBorn") = Text3.Text
    Adodc1.Recordset.Update
    MsgBox "Data Added"
End Sub
Jade_me commented: Helping.. +4
Jx_Man 987 Nearly a Senior Poster Featured Poster

also to asign database field to dtpicker DTPicker1 = rs.Fields("birthday")

Jx_Man 987 Nearly a Senior Poster Featured Poster

sorry but i'm in my office right now, but i found this project on net..
see if this help..

Jx_Man 987 Nearly a Senior Poster Featured Poster

this following code for editing data. change as you needed.

' Edit Query
SQlQuery = "UPDATE Data " & _
           " SET Name ='" & Trim(txtName.Text) & "'," & _
           " Address ='" & Trim(txtAddress.Text) & "'," & _
           " TelpNo ='" & Trim(txtTlpNo.Text) & "'," & _
           " Email ='" & Trim(txtEmail.Text) & "'" & _
           " WHERE Id='" & Trim(txtId.Text) & "'"
            
' Execute Sql query
Con.Execute SQlQuery, , adCmdText
' Message if record already edited
MsgBox "Data Successfully Edited"
Jx_Man 987 Nearly a Senior Poster Featured Poster

this following code for editing data. change as you needed.

' Edit Query
SQlQuery = "UPDATE Data " & _
           " SET Name ='" & Trim(txtName.Text) & "'," & _
           " Address ='" & Trim(txtAddress.Text) & "'," & _
           " TelpNo ='" & Trim(txtTlpNo.Text) & "'," & _
           " Email ='" & Trim(txtEmail.Text) & "'" & _
           " WHERE Id='" & Trim(txtId.Text) & "'"
            
' Execute Sql query
Con.Execute SQlQuery, , adCmdText
' Message if record already edited
MsgBox "Data Successfully Edited"
Jx_Man 987 Nearly a Senior Poster Featured Poster

first, Add reference before do all codes..
Click on Project->Reference, Find for Microsoft ActiveX Data Object 2.5 Library and select it.

this followwing code to connect vb6 with MS SqlServer
Create 1 button on your form

Public Con As New ADODB.Connection
Public rs As New ADODB.Recordset

Private Sub Command1_Click()
If Con.State = 1 Then Con.Close
    Con.ConnectionString = "Provider=MSDASQL;Driver={SQL Server}; " & _
    " SERVER=USER;Database=Test;Uid=;Pwd="
    Con.Open
MsgBox "VB6 has connected with SQLServer Database"

Con.Close
End Sub
dnk commented: thx ;) +4
Jx_Man 987 Nearly a Senior Poster Featured Poster

andreret already posting codes to add new record with adodb way..post no #2
as he said too, if you want to add,edit or delete record please divide your thread into a couple threads..
also how far you doing this..we didn't do all entire codes for you but we help to fix your codes :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

use tree view and list view.

Jx_Man 987 Nearly a Senior Poster Featured Poster

so you use adodc control?
post your code..how far u do this..

Jx_Man 987 Nearly a Senior Poster Featured Poster

see if this help :

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim sql As String
        Dim strjobno As String
        Dim Cn As OleDb.OleDbConnection
        Dim myCom As OleDb.OleDbCommand

        Cn = New OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Hardware.mdb")
        Cn.Open()
        sql = "sselect MAX(jobno) from repair"
        myCom = New OleDb.OleDbCommand(sql, Cn)
        strjobno = myCom.ExecuteScalar
        Cn.Close()
        If strjobno Is DBNull.Value Then
            Dim intjobno As Integer = Convert.ToInt32(strjobno)
            strjobno = 1
        Else
            strjobno = strjobno + 1
        End If
        TextBox1.Text = strjobno
    End Sub

if your code already completed then please mark this thread as Solved.

Jx_Man 987 Nearly a Senior Poster Featured Poster

show you effort first.

Jx_Man 987 Nearly a Senior Poster Featured Poster

check your input with your data type in database.
like date, your input must be suitable with database type.

Jx_Man 987 Nearly a Senior Poster Featured Poster

you're welcome..
please mark this thread as solved.