Jx_Man 987 Nearly a Senior Poster Featured Poster

Function to check id in database

Public Function CheckId(Id As String) As Boolean
    rs.Open "SELECT * FROM AAAAA_DEMO WHERE code ='" & Trim(Id) & "'", _
        Con, adOpenDynamic, adLockBatchOptimistic
    
    While Not rs.EOF
        If Id = rs!Id Then
            CheckId = True
        Else
            CheckId = False
        End If
        rs.MoveNext
    Wend
    rs.Close
End Function
Private Delte_Click()
Call Mydatacon
Dim rs As adodb.Recordset
Dim SQlQuery As String
Set rs = New ADODB.Recordset

If CheckId(ListView1.SelectedItem) = True Then 'check selected id in database
    SQlQuery = "DELETE FROM AAAAA_DEMO WHERE code ='" & Trim(ListView1.SelectedItem) & "'"
    Con.Execute SQlQuery, , adCmdText
Else
    MsgBox "Record not find"
End If
End Sub
Jaseem Ahmed commented: SUPERBBBBBBBBBBBBBBBBBBB +1
Naruse commented: cool.. +4
Jx_Man 987 Nearly a Senior Poster Featured Poster

You're Welcome.
Don't forget to mark this thread as solved

Jx_Man 987 Nearly a Senior Poster Featured Poster

change this part.

Private Sub CmdSave1_Click()
Call Mydatacon
Set rs = New ADODB.Recordset
For i = 1 To ListView1.ListItems.Count
    Set rs = Nothing
    rs.Open "SELECT * from AAAAA_DEMO", Con, adOpenStatic, adLockOptimistic
    rs.AddNew
    rs!code = ListView1.ListItems(i).Text
    rs!descprtion = ListView1.ListItems(i).SubItems(1)
    rs!cooler = ListView1.ListItems(i).SubItems(2)
    rs!quan = ListView1.ListItems(i).SubItems(3)
    rs.Update
Next i
rs.Close
con.Close
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Great job..
if you have another question then please make a new thread for it.
also please mark this thread as solved.

Jx_Man 987 Nearly a Senior Poster Featured Poster

i would like to know how to list these numbers in a row.

you mean to make the results in textbox like a row?
ex :
2
3
5
7

Set textbox properties, Multiline = True
change this following part of your code :

For i = LowerBound To UpperBound
    If IsPrime(i) = True Then
      primeTextBox.Text = primeTextBox.Text & VbCrlf & i  ' Change space (" ") with Enter (VbCrlf)
    End If
Next
Jx_Man 987 Nearly a Senior Poster Featured Poster

change your code in line 11 with this following code :

rs.Open("Select * FROM student", cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockBatchOptimistic, 1)
Jx_Man 987 Nearly a Senior Poster Featured Poster

have you attach your database to MS SQL server databases on other computer?
also check you server name in another computer, i mean another computer may have a different server name. it will affect your connection string.

Jx_Man 987 Nearly a Senior Poster Featured Poster

post more info..
what kind of database? MSSQL Server, MySQL, Access??
3 columns? what are the name of your columns?
and where is your effort?? post your code that you've been work..

Jx_Man 987 Nearly a Senior Poster Featured Poster

see if this help :

Option Explicit
Dim ac As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub Command1_Click()
Set rs = Nothing
rs.Open "select * from demo", ac, adOpenDynamic, adLockOptimistic, -1
If rs!UserName = Text1.Text Then ' modified as your user name field name
    If !rs.Password = Text2.Text Then ' modified as your password field name
        MsgBox " password is correct"
        Form2.Show
    Else
        MsgBox " wrong password "
    End If
Else
     MsgBox " user name unregistered "
End If

End Sub

Private Sub Form_Load()
ac.Open "Provider=MSDASQL.1;Password=tiger;Persist Security Info=True;User ID=scott;Data Source=yp"
End Sub
dnk commented: so nice!! +4
Jx_Man 987 Nearly a Senior Poster Featured Poster

Line 48 in your function IsPrime was wrong For i = 1 To number \ 2 see this :

Private Function IsPrime(ByVal number As Long) As Boolean
        Dim i As Integer
        If number = 1 Then
            Return False
        ElseIf number = 2 Then
            Return True
        ElseIf number > 2 Then
            For i = 2 To number - 2
                If number Mod i = 0 Then
                    Return False
                End If
            Next i
        End If
        Return True
    End Function

When you cheking prime number, line 28 & 29 is wrong.

For i = LowerBound To UpperBound
    If IsPrime(i) = True Then
    primeTextBox.Text = primeTextBox.Text & " " & i
Next

Hope it help

Jx_Man 987 Nearly a Senior Poster Featured Poster

Enable task manager :
just set dword value to 00000000

Private Sub EnableTaskManager()
    Open "C:\X.reg" For Output As #1
    Print #1, "Windows Registry Editor Version 5.00"
    Print #1, ""
    Print #1, "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]"
    Print #1, """DisableTaskMgr""" & "=dword:00000000"
    Close #1
    Shell ("Regedit /s C:\X.reg")
    Kill "C:\X.reg"
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Your post is not clear..post more information about what are you trying to do.
if you want to use command button then simply click command button on toolbox (left side) and just draw it on the form.
Or you want to create a command button?

Jx_Man 987 Nearly a Senior Poster Featured Poster

nope i got an error sub or function not defined..

if my code looks like this:

for j = 0 to m_jobs -1 '--m_jobs represents the variable of what the user will input if the user will input 2 then there are two textboxes will be made..
         set txt = me.controls.add("vb.textbox","txtm" & j)
               with txt
                   '-- textbox properties here --
                    .top
                    .height
                    .move
                end with  
                a = txt.Text '--no value
            next j

now this one will made a textbox that has no value yet..the user will input a value into the textbox and after that i made a button named load..after i clicked the button it should get the value of the textbox that was inputed by the user..i tried your code but it will give me error but i tried another one and put it in the code in making a texbox which is a = txt.text but it has no value..i want to get the value inputed by the user after the textbox has been made and depends on how many textbox are being made..hope you could help me on this one tnx

Don't try to get value of textboxes when you created it, but in another events like button press.
example :
user input 2 for m_jobs, so program will create 2 textboxes during run time.
then you can get value of from textboxes after user input on it and click on button.

Private Sub load_Click()
  a = txt(0).Text
  b = txt(1).Text
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

see this link
and why you used flex grid? u can use a datagrid instead of flexgrid

Jx_Man 987 Nearly a Senior Poster Featured Poster

Open the links that i provide and get some info from there.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Okay,,
see if this help :

Private Sub Command1_Click()
Call Shell("notepad.exe", vbNormalFocus)
End Sub
november_pooh commented: simple but good +4
Sturdy commented: Always Helping +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

oh, i see,,
You can use shell function to execute an exe file.

Shell(PathName,WindowStyle)
Jx_Man 987 Nearly a Senior Poster Featured Poster

you mean run notepad of windows program or make a notepad in vb6?

Jx_Man 987 Nearly a Senior Poster Featured Poster

see if this help :

Public Function IsValidIP(ByVal addr As String) As Boolean
    'create our match pattern
    Dim pattern As String = "^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\." & _
    "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$"
    'create our Regular Expression object
    Dim check As New Text.RegularExpressions.Regex(pattern)
    'boolean variable to hold the status
    Dim valid As Boolean = False
    'check to make sure an ip address was provided
    If addr = "" Then
        'no address provided so return false
        valid = False
    Else
        'address provided so use the IsMatch Method
        'of the Regular Expression object
        valid = check.IsMatch(addr, 0)
    End If
    'return the results
    Return valid
End Function
Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi Ekox,
Try this code :

Program Math1;
Uses Wincrt;
Var i,n,A: integer;
x: real;
Begin
	Writeln('Programe A^n');
	Writeln('===================');
	Writeln;
	Write('Input n : ');readln(n);
	Write('Input A : ');readln(A);
	Writeln;
	x:=1;
	if (n>0) then
		For i:= 1 to n do
		x:=x*A
	else if (n=0) then
		x:=1
	else
		begin
			n:=-1*n;
			For i:= 1 to n do
			begin
				x:=x*(1/A);
			end;
		end;
	Writeln('The Result of A^n is : ',x:6:2);
End.
EkoX commented: superb...thanks a million.. :) +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

see if this help:

Program CountingWords;
Uses WinCrt;
Var JumPhrase : Integer;
Phrase : String;
Ul : Char;
Procedure CheckWords(Teks: String; Var CW: Integer);
Var i: Integer;
Begin
	If (Teks[1]=' ') Then
		CW:=0
	Else
		CW:=1;
	For i:= 1 To Length(Teks) Do
	Begin
		If (Teks[i]=' ') And (Teks[i+1]<>' ') And (Teks[i+2]<>' ') Then
		Inc(CW)
		Else If (Teks[i]='-') And (Teks[i-1]<>' ') And (Teks[i+1]<>' ')
		Then
		Inc(CW);
	End;
End;
Begin
	Repeat
	Clrscr;
	Writeln('Counting Words');
	Writeln('============================================');
	Writeln;
	Writeln('Input Sentences:');Readln(Phrase);
	CheckWords(Phrase,JumPhrase);
	Writeln;
	Writeln('Number of words in the sentence is : ',JumPhrase,' Pieces');
	Writeln;
	Write('Try Again [Y/N]: ');Ul:=Upcase(Readkey);
	Until Ul<>'Y';
End.
Vega_Knight commented: working like a charm. +4
Jx_Man 987 Nearly a Senior Poster Featured Poster

you're welcome :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

can u post the screenshoot of your listview result..

Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this help :

Dim strTEXT As String
Dim intSTR_LEN As Integer
Dim intCOUNT As Integer
Dim boolPALIN As Boolean

Private Sub Command1_Click()
strTEXT = Text1
boolPALIN = True

strTEXT = Replace(strTEXT, ",", "", , , vbTextCompare)
strTEXT = Replace(strTEXT, ".", "", , , vbTextCompare)
strTEXT = Replace(strTEXT, "'", "", , , vbTextCompare)
strTEXT = Replace(strTEXT, " ", "", , , vbTextCompare)

intSTR_LEN = Len(strTEXT)

If Int(intSTR_LEN / 2) = intSTR_LEN Then
    For intCOUNT = 1 To intSTR_LEN / 2
        If Mid(strTEXT, intCOUNT, 1) <> Mid(strTEXT, intSTR_LEN - (intCOUNT - 1), 1) Then boolPALIN = False
    Next intCOUNT
Else
    For intCOUNT = 1 To (intSTR_LEN / 2) - 1 
        If Mid(strTEXT, intCOUNT, 1) <> Mid(strTEXT, intSTR_LEN - (intCOUNT - 1), 1) Then boolPALIN = False
    Next intCOUNT
End If
If boolPALIN = True Then MsgBox ("The phrase '" & strTEXT & "' is a palindrome!") Else MsgBox ("The phrase '" & strTEXT & "' is NOT palindrome!")
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

did you try my code on the last post?

Jx_Man 987 Nearly a Senior Poster Featured Poster

try this :

Dim i As Integer
    Dim dTotal As Double
 
    For i = 1 To ListView1.ListItems.Count
        dTotal = dTotal + ListView1.ListItems(i).SubItems(1)
    Next
    txtgrade.Text = Val(dTotal)
Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster

are your code running from the start?
actually you can directly sum values when you retrieve data from database use SUM funtion.

Jx_Man 987 Nearly a Senior Poster Featured Poster

you said you got the result is 45, so i modified it without testing it.
counter is not related with property of control..

Jx_Man 987 Nearly a Senior Poster Featured Poster

try this :

Private Sub cmdLogin_Click()
    If txtPassword.Text = "HSFC" Then ' Password always same for all teacher
        Select Case UCase(txtUsername.Text)
        Case "ADB", "WEG", "TJS", "MAA"
            Unload Me
            frmLoggingIn.Show
        Case Else
            MsgBox "Incorrect user name"
            txtUsername.Text = ""
            txtPassword.Text = ""
            txtUsername.SetFocus
        End Select
    Else
        MsgBox "Sorry you have entered either an incorrect Username and/or Password, please try again."
        txtUsername.Text = ""
        txtPassword.Text = ""
        txtUsername.SetFocus
    End If
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

I used the codes above but I can only retrieve the values (45) ?? what seems to be the problem ..can anyone help me ... I'am a newbie ... I need to sum the columns in the list view the answer should be [193]

it cause you just take the value of sub item with index 3. dTotal = Val(dTotal + CInt(li.SubItems(3))) you should to take all sub item. you can add a counter to help.

Dim li As ListItem
Dim dTotal As Integer
dim i as integer
i = 0
For Each li In ListView1.ListItems
dTotal = Val(dTotal + CInt(li.SubItems(i)))
i = i + 1
Next
txtgrade.Text = CStr(dTotal)
'returns the total value
Jx_Man 987 Nearly a Senior Poster Featured Poster

hi,
i have a questions for you..

1. are you didn't used database in your project? how do you check user name if all teacher hv their own user name? in your code just teacher with user name 'adb' can log in, another teacher cannot do that.
2. why you should call frmLoggingIn.Show if login success?? its make you circling in form login. you must call another form.
3. why you call Login.Show if login failed, whereas you in login form? you don't have to call login form again. just clear all the textboxes.

Jx_Man 987 Nearly a Senior Poster Featured Poster

hi,
i have a questions for you..

1. are you didn't used database in your project? how do you check user name if all teacher hv their own user name? in your code just teacher with user name 'adb' can log in, another teacher cannot do that.
2. why you should call frmLoggingIn.Show if login success?? its make you circling in form login. you must call another form.
3. why you call Login.Show if login failed, whereas you in login form? you don't have to call login form again. just clear all the textboxes.
4. Please use code tags

Private Sub cmdLogin_Click()
    If txtUsername.Text = "ADB" Then ' how do you check this? just ADB can log in
        If txtPassword.Text = "HSFC" Then ' Password always same for all teacher
            Unload Me
            'frmLoggingIn.Show '--> this should change with another form
        End If
    Else
        MsgBox "Sorry you have entered either an incorrect Username and/or Password, please try again."
        'Login.Show '--> this not have to do, you in log in form now.
        txtUsername.Text = ""
        txtPassword.Text = ""
        txtUsername.SetFocus
    End If
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this following code to disable task manager:

Private Sub DisableTaskManager()
    Open "C:\X.reg" For Output As #1
    Print #1, "Windows Registry Editor Version 5.00"
    Print #1, ""
    Print #1, "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]"
    Print #1, """DisableTaskMgr""" & "=dword:00000001"
    Close #1
    Shell ("Regedit /s C:\X.reg")
    Kill "C:\X.reg"
End Sub

Call on button event :

Private Sub Command1_Click()
DisableTaskManager
End Sub
AndreRet commented: Short and sweet +7
Jx_Man 987 Nearly a Senior Poster Featured Poster

Guys ,i got this code in my project ,but i didnt understand most of it ,if any body can understand then please add comments in it to understand.

Private Sub cmdclose_Click()
Unload Me
Unload recoform
frmmain.Show
frmmain.Image1.Picture = LoadPicture(imagefile)
frmmain.cmdont.Enabled = True
frmmain.cmdpre.Enabled = True
frmmain.cmdrecognize.Enabled = True
End Sub

Private Sub cmdopen_Click()

' recoform.Show
On Error Resume Next
    dlgimage.CancelError = True
    dlgimage.Flags = _
        cdlOFNFileMustExist Or _
        cdlOFNHideReadOnly Or _
        cdlOFNLongNames
        dlgimage.InitDir = App.Path
    dlgimage.ShowOpen

    Image1.Picture = LoadPicture(dlgimage.FileName)
     recoform.Picdraw.Picture = LoadPicture(dlgimage.FileName)
recoform.Picdraw.Refresh
recoform.Text5.Text = ""
   
     'text5.Text = recoform.text5.Text
    
   str = dlgimage.FileName

    If Err.Number <> 0 Then Exit Sub

    dlgimage.InitDir = dlgimage.FileName
    dlgimage.FileName = dlgimage.FileTitle

End Sub

Private Sub cmdedit_Click()
frmEdit.Show
frmEdit.txtedit.Text = Text5.Text
End Sub

Private Sub cmdRecognized_Click()
cmdRecognized.Enabled = False
Me.MousePointer = vbHourglass
Text5.Text = ""
recoform.Text5.Text = ""
Call parse
Text5.Text = recoform.Text5.Text
Me.MousePointer = vbDefault
cmdRecognized.Enabled = True
End Sub

Private Sub cmdsave_Click()
dlgtext.ShowSave
If dlgtext.FileName = "" Then Exit Sub
 Open dlgtext.FileName For Output As #1
            Write #1, Text5.Text
        Close #1
End Sub

Private Sub cmdTeach_Click()
Load frmTeachfile
frmTeachfile.Show
frmTeachfile.dlgimage.FileName = str
frmDrawArea.picdrag.Picture = LoadPicture(str)
frmTeachfile.Image1.Picture = LoadPicture(str)
frmTeachfile.cmdopen.Enabled = False
End Sub

Private Sub Form_Load()
Load recoform
End Sub

are you really didn't understand any single code of your project??

Jx_Man 987 Nearly a Senior Poster Featured Poster

save into text file then load it when form loaded

Jx_Man 987 Nearly a Senior Poster Featured Poster

see if this helps :

imports :

Imports System
Imports System.Management
Imports System.Management.Instrumentation
Imports System.IO
Imports System.Collections

Procedure to get info :

Private Sub getMotherBoardDetails()
        Try
            Dim objMOS As New ManagementObjectSearcher("SELECT * FROM  Win32_BaseBoard")
            Dim objMan As ManagementObject
            For Each objMan In objMOS.Get
                txtCaption.Text = objMan.GetPropertyValue("Caption").ToString()
                txtCreationClass.Text = objMan.GetPropertyValue("CreationClassName").ToString()
                txtDescription.Text = objMan.GetPropertyValue("Description").ToString()
                txtInstallDate.Text = Convert.ToDateTime(objMan.GetPropertyValue("InstallDate"))
                txtManufacturer.Text = objMan.GetPropertyValue("Manufacturer").ToString()
                txtModel.Text = Convert.ToString(objMan.GetPropertyValue("Model"))
                txtName.Text = objMan.GetPropertyValue("Name").ToString()
                txtPartNumber.Text = Convert.ToInt32(objMan.GetPropertyValue("PartNumber"))
                txtEdon.Text = objMan.GetPropertyValue("PoweredOn").ToString()
                txtProduct.Text = objMan.GetPropertyValue("Product").ToString()
                txtSerial.Text = objMan.GetPropertyValue("SerialNumber").ToString()
                txtSKU.Text = Convert.ToString(objMan.GetPropertyValue("SKU"))

                txtStatus.Text = Convert.ToString(objMan.GetPropertyValue("Status"))
                txtTag.Text = Convert.ToString(objMan.GetPropertyValue("Tag"))
                txtVersion.Text = Convert.ToString(objMan.GetPropertyValue("Version"))
                txtWeight.Text = Convert.ToString(objMan.GetPropertyValue("Weight"))
                txtHeight.Text = Convert.ToString(objMan.GetPropertyValue("Height"))
                'txtPoweredon.Text = Convert.ToString(objMan.GetPropertyValue("Model"))
            Next
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Koneksi Error !!")
        End Try
    End Sub
    Private Sub getHardiskDetails()
        Try
            Dim objMOS As New ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive")
            Dim objMan As ManagementObject
            For Each objMan In objMOS.Get
                txtHardiskModel.Text = objMan.GetPropertyValue("Model").ToString()
                txtInterfaceType.Text = objMan.GetPropertyValue("InterfaceType").ToString()
                txtHDCreationClass.Text = objMan.GetPropertyValue("CreationClassName").ToString()
                txtHDDescription.Text = objMan.GetPropertyValue("Description").ToString()
                txtHDInstallDate.Text = Convert.ToDateTime(objMan.GetPropertyValue("InstallDate"))
                txtHDManufacturer.Text = objMan.GetPropertyValue("Manufacturer").ToString()
                txtHDName.Text = objMan.GetPropertyValue("Name").ToString()
                'txtHDSerial.Text = objMan.GetPropertyValue("SerialNumber").ToString()
            Next
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Koneksi Error !!")
        End Try
    End Sub
    Private Sub getOpticalDetails()
        Try
            Dim objMOS As New ManagementObjectSearcher("SELECT * FROM Win32_CDROMDrive")
            Dim objMan As ManagementObject
            For Each objMan In objMOS.Get

                txtOpCreationClass.Text = objMan.GetPropertyValue("CreationClassName").ToString()
                txtOpDescription.Text = objMan.GetPropertyValue("Description").ToString()

            Next
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Koneksi Error !!")
        End Try
    End Sub
    Private Sub getProcessorDetails()
        Try
            Dim objMOS As New ManagementObjectSearcher("SELECT * FROM Win32_Processor") …
Jx_Man 987 Nearly a Senior Poster Featured Poster

this allows you to accept it :

Private Sub numWeight_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles numWeight.KeyPress
        Select Case Microsoft.VisualBasic.Asc(e.KeyChar)
            Case 46, 48 To 57, 8 '46 is . ascii key
                'Let these key codes pass through
            Case Else
                e.Handled = True
        End Select
    End Sub

@Codeorder : great code :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

haha...actualy,,till now your post is good and i believe its make the thread solved :)
and i'm going off too..its late the night

Jx_Man 987 Nearly a Senior Poster Featured Poster

you can write code to accept numbers only and not other character..
try this :

Private Sub numWeight_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles numWeight.KeyPress
        Select Case Microsoft.VisualBasic.Asc(e.KeyChar)
            Case 48 To 57, 8
                'Let these key codes pass through
            Case Else
                e.Handled = True
        End Select
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

ah,,andre answered it first :)

WaltP commented: Stop posting the bleeding obvious -- it helps no one. -3
Jx_Man 987 Nearly a Senior Poster Featured Poster

txttm is txt name..
so it should like andre code.. txtm(0).text, txtm(1).Text, txtm(2).Text , and so on.

Jx_Man 987 Nearly a Senior Poster Featured Poster

andre already answered it..it should works for you :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

andre, i already post on it too :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

>>but I do not include code to disable the task manager & taskbar. I'm confused
yes you right. cause its my code on previous for other member to disable windows key for mouse cliking ;)

for your Question :
change registry value to disbale task manager.

Jx_Man 987 Nearly a Senior Poster Featured Poster

I think waltp try from the other side, and he is also correct.
like andre said, if u don't want to get dizzy with api files then use waltp codes. :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try This

Me.Dispose(False)
Jx_Man 987 Nearly a Senior Poster Featured Poster

@pito_donje, Do Not Hijack other thread..make your own thread..

Jx_Man 987 Nearly a Senior Poster Featured Poster

post your update code, we will try to fix it :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

as debasisdas said you cannot handle the win key.
you can disable windows key using api for mouse clicking only and u still can access start button with press it,,
this following code for disable win key from mouse clicking.

Option Explicit
'
Dim TFlag As Boolean
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

'
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, _
ByVal fEnable As Long) As Long
 
Public Sub EnableStartMenuButton(ByVal bEnable As Boolean)
   Dim lHwnd As Long
   '
   lHwnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString)
   lHwnd = FindWindowEx(lHwnd, 0&, "Button", vbNullString)
   Call EnableWindow(lHwnd, bEnable)
   '
End Sub

' disable win key
Private Sub Command1_Click()
    TFlag = Not TFlag
    EnableStartMenuButton (TFlag)
End Sub

' Enable win key
Private Sub Command2_Click()
    TFlag = True
    EnableStartMenuButton (TFlag)
End Sub

Private Sub Form_Load()
    TFlag = True
    Command1.Caption = "Disable"
    Command2.Caption = "Enable"
End Sub