Jx_Man 987 Nearly a Senior Poster Featured Poster

how about two listview.
one for input data (added data to listview then add it), one for displaying data.

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

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

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

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

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

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

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

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

save into text file then load it when form loaded

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

>>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

Try This

Me.Dispose(False)
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

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

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

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

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

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

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

@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")