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

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

Jx_Man 987 Nearly a Senior Poster Featured Poster

otomatis, if this thread already answered then please mark this thread as solved.

Jx_Man 987 Nearly a Senior Poster Featured Poster

if this thread already solved.
please mark as solved.

Jx_Man 987 Nearly a Senior Poster Featured Poster
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim x As Double
        Dim i As Integer
        Dim sortarray(20) As Integer
        Randomize()
        For i = 1 To 20
            sortarray(i) = Rnd() * 100
        Next
        Array.Sort(sortarray)
        For i = sortarray.GetUpperBound(0) To 0 Step -1
            ListBox1.Items.Add(sortarray(i).ToString)
        Next i
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster
Public x = 1 'This is whats wrong - it says "End of statement expected" when mouse over 
Public y = 1 'the "1"
Jx_Man 987 Nearly a Senior Poster Featured Poster

your information is not clear..and please use code tags

Jx_Man 987 Nearly a Senior Poster Featured Poster

you must create a button in toolbox and insert icon for it..
right click on toolbar-> properties
You can add button and insert icon there.

Jx_Man 987 Nearly a Senior Poster Featured Poster

>>Does it requires the Complete change in the code of the project or only a little changes
maybe yes, but it's not a big problem if you have working a lot with other DBMS..

see this thread :
One
Two
Three

see this site :
One
Two
Three
Four

Pdf Files

Jx_Man 987 Nearly a Senior Poster Featured Poster

not clear..more information friend...
User input current username in form1 and directed to form2..
In form2, Do you want to insert new data or you want to edit current user data?
if u want to edit current data in form2 then you should to use update query.

Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this help :

Program CalculateDistance;
Uses WinCrt;
var
	x1,x2,y1,y2:integer;
	d:real;
begin
	Writeln;
	Write('Input A (X1): ');readln(x1);
	Write('Input B (X2): ');readln(x2);
	Write('Input A (Y1): ');readln(y1);
	Write('Input B (Y2): ');readln(y2);
	d:=sqrt(sqr(x2-x1)+sqr(y2-y1));
	Writeln;
	Writeln('Distance between A and B is: ',d:4:2);
end.
Sawamura commented: Quick respon +4
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this, it will return the position on the screen in pixels of the cursor :

Option Explicit
Private Type POINTAPI
    X As Long
    Y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Public Function GetXCursorPos() As Long
   Dim pt As POINTAPI
   GetCursorPos pt
   GetXCursorPos = pt.X
End Function

Public Function GetYCursorPos() As Long
   Dim pt As POINTAPI
   GetCursorPos pt
   GetYCursorPos = pt.Y
End Function

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label1.Caption = "X Screen Position = " & GetXCursorPos
    Label2.Caption = "Y Screen Position =  " & GetYCursorPos
End Sub

Hope it helps.

Vega_Knight commented: Great Help +4
Jx_Man 987 Nearly a Senior Poster Featured Poster

You're WElcome paulablanca, Dont Forget to mark this thread solved.

Jx_Man 987 Nearly a Senior Poster Featured Poster

arezz09 : codeorder give the complete guide :)

Jx_Man 987 Nearly a Senior Poster Featured Poster
' this for create folder at c:\MyPicture\
If (Not System.IO.Directory.Exists("C:\MyPicture")) Then
    System.IO.Directory.CreateDirectory("C:\MyPicture")
End If

'this for open file in picture box
    Dim OpenFileDialog1 As New OpenFileDialog
    With OpenFileDialog1
        .CheckFileExists = True
        .ShowReadOnly = False
        .Filter = "All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg"
        .FilterIndex = 2

        If .ShowDialog = DialogResult.OK Then
            ' Load the specified file into a PictureBox control.
            PictureBox1.Image = Image.FromFile(.FileName)
        End If
    End With
	
' this for copying file
If System.IO.File.Exists(SourcePath) = True Then
    File.Copy(SourcePath, DestinationPath, True)
End If
Jx_Man 987 Nearly a Senior Poster Featured Poster

try this following codes :

' Shutdown
Private Const EWX_LogOff As Long = 0
Private Const EWX_SHUTDOWN As Long = 1
Private Const EWX_REBOOT As Long = 2
Private Const EWX_FORCE As Long = 4
Private Const EWX_POWEROFF As Long = 8

Private Declare Function ExitWindowsEx Lib "user32" (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long

Private Type LUID
UsedPart As Long
IgnoredForNowHigh32BitPart As Long
End Type

Private Type LUID_AND_ATTRIBUTES
TheLuid As LUID
Attributes As Long
End Type
Private Type TOKEN_PRIVILEGES
PrivilegeCount As Long
TheLuid As LUID
Attributes As Long
End Type

Private Declare Function GetCurrentProcess Lib "kernel32" () As Long

Private Declare Function OpenProcessToken Lib "advapi32" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long

Private Declare Function LookupPrivilegeValue Lib "advapi32" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, _
ByVal lpName As String, lpLuid As LUID) As Long

Private Declare Function AdjustTokenPrivileges Lib "advapi32" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, _
NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As TOKEN_PRIVILEGES, ReturnLength As Long) As Long

Private Declare Sub SetLastError Lib "kernel32" (ByVal dwErrCode As Long)

Private Sub AdjustToken()

Const TOKEN_ADJUST_PRIVILEGES = &H20
Const TOKEN_QUERY = &H8
Const SE_PRIVILEGE_ENABLED = &H2

Dim hdlProcessHandle As Long
Dim hdlTokenHandle As Long
Dim tmpLuid As LUID
Dim tkp As TOKEN_PRIVILEGES
Dim tkpNewButIgnored As TOKEN_PRIVILEGES
Dim lBufferNeeded As Long

SetLastError 0

hdlProcessHandle = GetCurrentProcess()

OpenProcessToken hdlProcessHandle, (TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY), hdlTokenHandle

LookupPrivilegeValue "", "SeShutdownPrivilege", tmpLuid

tkp.PrivilegeCount = 1
tkp.TheLuid = tmpLuid
tkp.Attributes = SE_PRIVILEGE_ENABLED

AdjustTokenPrivileges hdlTokenHandle, …
Estella commented: Nice codes ;) +4
dnk commented: Great Code Jx :) +4
Jx_Man 987 Nearly a Senior Poster Featured Poster

try this following code :

Program Decimal_Binary;
Uses WinCrt;
Var
	Dec,Deci: Integer;
	Bin: String;
	Ul:Char;
Begin
	Repeat
		Clrscr;
		Writeln('Decimal to Binary Convertion Program');
		Writeln('======================================');
		Writeln;
		Write('Input Decimal Number: ');Readln(Dec);
		Deci:=Dec;
		Bin:='';
		Repeat
			If(Dec Mod 2 = 0) Then
				Bin:='0'+Bin
			Else
				Bin:='1'+Bin;
			Dec:=Dec Div 2;
		Until Des=0;
		Writeln;
		Writeln(Deci,' Decimal = ',Bin,' Binary');
		Writeln;
		Write('Try Again? [Y/N]: ');Readln(Ul);
		Ul:=Upcase(Ul);
	Until (Ul<>'Y');
End.

hope it helps

Neji commented: good one +4
november_pooh commented: Thx..relly helps :) +3
Sawamura commented: helping.. +4
Jx_Man 987 Nearly a Senior Poster Featured Poster

binding data on combo box manualy then add items as u want.

Jx_Man 987 Nearly a Senior Poster Featured Poster

same as pgmer, you must ensure that your query is correct.

Jx_Man 987 Nearly a Senior Poster Featured Poster

hmm..i got wrong here..

Private Sub List1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyDown Then
    List1.ToolTipText = List1.List(List1.ListIndex + 1)
ElseIf KeyCode = vbKeyUp Then
    List1.ToolTipText = List1.List(List1.ListIndex - 1)
End If
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

i'm modified andreRet code a bit ;)

Private Sub List1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyDown Or KeyCode = vbKeyUp Then
    List1.ToolTipText = List1.List(List1.ListIndex + 1)
End If
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster
me.dispose(false)
Jx_Man 987 Nearly a Senior Poster Featured Poster

@AndreRet : alleybye learn much about date from u, i think ;)

Jx_Man 987 Nearly a Senior Poster Featured Poster

or more shorter :

Private Sub AddDaysToMonthBox(ByVal Day As Integer)
        Dim i As Integer
        With DayBox.Items
            For i = 1 To Day
                .Add(i)
            Next
        End With
    End Sub

    Private Sub monthBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MonthBox.SelectedIndexChanged
        Dim i As Integer
        If MonthBox.SelectedIndex = 1 Then
            If IsNumeric(YearBox.Text) Then
                If Int(YearBox.Text) > 1950 Or Int(YearBox.Text) < 1996 Then
                    If Date.IsLeapYear(Int(YearBox.Text)) Then
                        AddDaysToMonthBox(29)
                    Else
                        AddDaysToMonthBox(28)
                    End If
                Else
                    AddDaysToMonthBox(31)
                End If
            End If
        End If
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

1. Add the days until 31 on MonthBox Collection
2. Just check leap year on MonthBox Event, you didn't need to check on YearBox Event.

it's like this :

Private Sub monthBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MonthBox.SelectedIndexChanged
        Dim i As Integer
        If MonthBox.SelectedIndex = 1 Then
            If IsNumeric(YearBox.Text) Then
                If Int(YearBox.Text) > 1950 Or Int(YearBox.Text) < 1996 Then
                    If Date.IsLeapYear(Int(YearBox.Text)) Then
                        With DayBox.Items
                            For i = 1 To 29 ' if leap year
                                .Add(i)
                            Next
                        End With
                    Else
                        With DayBox.Items
                            For i = 1 To 28 ' if not leap year
                                .Add(i)
                            Next
                        End With
                    End If
                End If
            End If
        Else
            With DayBox.Items
                For i = 1 To 31
                    .Add(i)
                Next
            End With
        End If
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

just check leap year on monthbox event..so u didn't need to check on yearbox event.

Jx_Man 987 Nearly a Senior Poster Featured Poster
me.combobox1.text = 3
Jx_Man 987 Nearly a Senior Poster Featured Poster

haha..i'm just like your posting..just it friend.. :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

AndreRet : actually u give a complete guide :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

actualy,,i just added a parameter, it cause your procedure never get the value (inc) updated when u checking the inc or maxrow. so, an error depend on your codes.
so where the error exactly? which line of your codes?

Jx_Man 987 Nearly a Senior Poster Featured Poster

MySQL is free..

Jx_Man 987 Nearly a Senior Poster Featured Poster

control box?
u mean title bar?
using API files i think..

Jx_Man 987 Nearly a Senior Poster Featured Poster

your procedure navigaterecords() not have a parameter..
so when u call it, your procedure didn't get new value of inc variable.

so,, add the parameter on your procedure :

Public Sub navigaterecords(ByVal inc as Integer)
...
End sub

when call :

If inc <> 0 Then
    inc = 0
    navigaterecords(Inc)
End If
Jx_Man 987 Nearly a Senior Poster Featured Poster

on any event :

SendKeys.Send("{ENTER}") 'for enter
SendKeys.Send("{%}") 'for Alt
SendKeys.Send("{^}") 'for Ctrl
SendKeys.Send("{+}") 'for shift
' Combination
SendKeys.Send("^(c)") 'for Ctrl-C


More information, go to msdn online

anyway you posting on wrong section..this section for vb 4,5,6 not for vb.net section.

Fa3hed commented: good +1
Estella commented: Yes. that way +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

@Jaseem Ahmed : your code use sql server or access for database?
@AndreRet : i think this code using sql server, coz your codes using for access, maybe u missed it :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

simplier?
i think there are simple enough..
my link and debasisdas link are same..
and like debasisdas said..the codes aren't complex..
just contains many if-else statment..

Sawamura commented: thx +4
Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster

show how far u trying it..
just post the codes where u have a wrong logic of put a msgbox..

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try the following codes:


Copy

Clipboard.Clear
Clipboard.SetText ActiveForm.ActiveControl.SelText, vbCFText

Cut

Clipboard.Clear
Clipboard.SetText ActiveForm.ActiveControl.SelText, vbCFText
ActiveForm.ActiveControl.SelText = ""

Paste

If Clipboard.GetFormat(vbCFText) Then
ActiveForm.ActiveControl.SelText = Clipboard.GetText(vbCFText)
End If
AndreRet commented: Nicely executed. +6
Jade_me commented: its done..thx :) +4
Jx_Man 987 Nearly a Senior Poster Featured Poster

txtAccountHolder.Text = myDataReader.Item("First_Name&" - " &Surname")tostring]

chage it with :

txtAccount_Name.Text = myDataReader.Item("First_Name").ToString & "-" & myDataReader.Item("Surname").ToString
Sawamura commented: Nice +4
dnk commented: fast.. +4
Jx_Man 987 Nearly a Senior Poster Featured Poster

make a procedure to select the last number on tran_head and add it with 1..that a autonumber logic..

Jx_Man 987 Nearly a Senior Poster Featured Poster

install .net framework first on client pc

Jx_Man 987 Nearly a Senior Poster Featured Poster

show us your code friend..