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

well, i never do this. i works under .net 2003 and .net 2003 not including TableLayoutPanel.

Jx_Man 987 Nearly a Senior Poster Featured Poster

cause the equation is (1.2 / 4) + 0.002 in your code not 1.25/4

Jx_Man 987 Nearly a Senior Poster Featured Poster

oh..and set timer interval = 1 to get fast update.

Jx_Man 987 Nearly a Senior Poster Featured Poster

if you want value always update, you can use timer.
put timer control on your form and add the code in it. don't forget to set timer enable properties = true

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        label1.Text = Form1.temp
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

no, you don't have to terminate program, just close form2 and open again cause code works in form load event. why you put label in form2 not in common feature form?

Jx_Man 987 Nearly a Senior Poster Featured Poster

- i think vb is easy to learn than c#.
- no many different between them. one different that i find is encapsulation between form. in vb6 u can access anything in other form from another form, in .net you must make variable to get value. and more easy to make report.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Ok.. see this example.
we have 2 form, you want to pass value from textboxt in form1 to label in form2.
in form 1 :
declare this code after windows generated code or before events.

Public Shared temp As String

in whatever event in form 1

temp = textbox1.text

in Form 2.
you just take the value in temp

label1.text = form1.temp
Jx_Man 987 Nearly a Senior Poster Featured Poster
Public Declare Function PlaySound Lib "winmm.dll" (ByVal pszSound As String, ByVal hmod As IntPtr, ByVal fdwSound As Integer) As Boolean
    'Public Declare Function PlaySound Lib "winmm.dll" (ByVal pszSound As Byte(), ByVal hmod As IntPtr, ByVal fdwSound As SoundFlags) As Boolean
    Public Enum SoundFlags As Integer
        ''' <summary>
        ''' The sound is played synchronously, and PlaySound returns after
        ''' the sound event completes. This is the default behavior.
        ''' </summary>
        SND_SYNC = &H0

        ''' <summary>
        ''' The sound is played asynchronously and PlaySound returns
        ''' immediately after beginning the sound. To terminate an
        ''' asynchronously played waveform sound, call PlaySound with
        ''' pszSound set to NULL.
        ''' </summary>
        SND_ASYNC = &H1

        ''' <summary>
        ''' No default sound event is used. If the sound cannot be found,
        ''' PlaySound returns silently without playing the default sound.
        ''' </summary>
        SND_NODEFAULT = &H2

        ''' <summary>
        ''' The pszSound parameter points to a sound loaded in memory.
        ''' </summary>
        SND_MEMORY = &H4

        ''' <summary>
        ''' The sound plays repeatedly until PlaySound is called again
        ''' with the pszSound parameter set to NULL. If this flag is
        ''' set, you must also set the SND_ASYNC flag.
        ''' </summary>
        SND_LOOP = &H8

        ''' <summary>
        ''' The specified sound event will yield to another sound event
        ''' that is already playing. If a sound cannot be played because
        ''' the resource needed to generate that sound is busy playing
        ''' another sound, the function immediately returns False without
        ''' playing the requested sound.
        ''' </summary>
        ''' <remarks>If …
Jx_Man 987 Nearly a Senior Poster Featured Poster

1. if u just want to display i think label is better.
2. use public shared variable to pass value from one to another form.

Jx_Man 987 Nearly a Senior Poster Featured Poster

i didn't get the point... and please insert a picture (you can attach..use forum facility), don't give a link.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi sammy...
please don't do like this again, you can post on previous post if you want to do like this.
Ok. i repost again the files.

Neji commented: once again for your great code :) +1
Sawamura commented: Perfectly +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

yes, you don't have parameter to update. i mean your key to update. your code its not specify who to update.
you need key :
where KeyName = ???. ex : where IdMember='"123"'
and you loosing to add single quote :

ExecuteSqlCommand("update member set tmembername='" & membername & "', taddress='" & address & "' and handphone='" & handphone & "' Where IdMember = '"???"' " )
Jx_Man 987 Nearly a Senior Poster Featured Poster

txtStartUp is path of startup folder
YourExeNameOnStartUpFolder.exe is your exe file name when it copied into startup folder.
put this following code into your current event :

FileCopy App.EXEName & ".exe", txtStartupPath & "\YourExeNameOnStartUpFolder.exe"
msgbox "Copying Success"

Hope this helps...

Estella commented: nice one +1
november_pooh commented: always help with great code :) +1
ITKnight commented: Good +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

see this following code :

Dim mShell
Set mShell = CreateObject("WScript.Shell")
txtPath  = mShell.SpecialFolders("Startup")

Hope this helps..

november_pooh commented: thank you very much +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

on below of last post you can see a link "mark as solved", click on it to make this thread solved.

Jx_Man 987 Nearly a Senior Poster Featured Poster

why you must get startup path??what you want to do?

Jx_Man 987 Nearly a Senior Poster Featured Poster

use this follwing code :
needed two listbox named list1 and list2

Const TH32CS_SNAPHEAPLIST = &H1
Const TH32CS_SNAPPROCESS = &H2
Const TH32CS_SNAPTHREAD = &H4
Const TH32CS_SNAPMODULE = &H8
Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST Or TH32CS_SNAPPROCESS Or TH32CS_SNAPTHREAD Or TH32CS_SNAPMODULE)
Const TH32CS_INHERIT = &H80000000
Const MAX_PATH As Integer = 260
Private Type PROCESSENTRY32
    dwSize As Long
    cntUsage As Long
    th32ProcessID As Long
    th32DefaultHeapID As Long
    th32ModuleID As Long
    cntThreads As Long
    th32ParentProcessID As Long
    pcPriClassBase As Long
    dwFlags As Long
    szExeFile As String * MAX_PATH
End Type
Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Private Declare Function Process32First Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapShot As Long, uProcess As PROCESSENTRY32) As Long
Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32.dll" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hHandle As Long) As Long
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
'Enum the path
Private Const PROCESS_QUERY_INFORMATION As Long = &H400
Private Const PROCESS_VM_READ = &H10
Private Declare Function EnumProcessModules Lib "psapi.dll" (ByVal hProcess As Long, ByRef lphModule As Long, ByVal cb As Long, ByRef cbNeeded As Long) As Long
Private Declare Function GetModuleFileNameExA Lib "psapi.dll" (ByVal hProcess As Long, ByVal hModule As Long, ByVal ModuleName As String, ByVal nSize As Long) As Long


Private …
ITKnight commented: thanks :) +1
Estella commented: wow, Great Code :D +1
Sawamura commented: Great Code :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

use this following code :

Private Const MAX_COMPUTERNAME_LENGTH As Long = 31
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Private Sub GetCompName()
Dim dwLen As Long
    Dim strString As String
    'Create a buffer
    dwLen = MAX_COMPUTERNAME_LENGTH + 1
    strString = String(dwLen, "X")
    'Get the computer name
    GetComputerName strString, dwLen
    'get only the actual data
    strString = Left(strString, dwLen)
    'Show the computer name
    MsgBox "WELCOME " & strString
   
End Sub

Private Sub Form_Load()
GetCompName
End Sub
Naruse commented: this is very Great Code. Works like charm :). thanks buddy +1
Neji commented: help me too +1
Jx_Man 987 Nearly a Senior Poster Featured Poster
If IsDate(textDate.Text) = True Then
            MsgBox("correct date")
        Else
            MsgBox("input correct date")
        End If
ITKnight commented: usefull +1
dnk commented: great +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

what data format??specify more the problem friend :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

why you don't remove all item on left list, so none items well of in left list. all items has been moved to right list.
it make you don't have to prompt an error message when user click the same button.

Jx_Man 987 Nearly a Senior Poster Featured Poster

hi thando..welcome to daniweb friend :).
what version of vb that u using to play flash??
vb 6 or vb.net cause derice use .net.
if u using vb.net, u can download the file for flash player using .net on my post above # 4, named "Flash Player.Zip"
what the problem that u facing now?error or what?
Post your code, so we can help u.

Jx_Man 987 Nearly a Senior Poster Featured Poster

you're welcome sainiricha.
don't forget to mark this thread solved.
happy coding friend :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

show your code and what the effort of that.

Jx_Man 987 Nearly a Senior Poster Featured Poster
SELECT * FROM TableName WHERE ColumnName like '%" & textBox1.Text & "%'
Naruse commented: got it +1
Jx_Man 987 Nearly a Senior Poster Featured Poster
select a.id, a.colname, b.colname from Table1 a join Table2 a on (a.id=b.id) where a.id = '1' order by a.id asc
Naruse commented: thanks +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

this an example code.

Private Sub cmdRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRemove.Click
    If ListLeft.SelectedIndex < 0 Then
        MsgBox("Please select an item", MsgBoxStyle.Exclamation, "Error")
    Else
        If ListLeft.Items.Count > 0 Then
            ListRight.Items.Add(ListLeft.SelectedItem)
            ListLeft.Items.Remove(ListLeft.SelectedItem)
        End If
    End If
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi...Welcome to Daniweb friend :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

this code for move item from listleft to listright :

Private Sub cmdRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRemove.Click
        If ListLeft.Items.Count > 0 Then
            ListRight.Items.Add(ListLeft.SelectedItem)
            ListLeft.Items.Remove(ListLeft.SelectedItem)
        End If
    End Sub

this code to move all item on listleft to list right :

Private Sub cmdAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAll.Click
        Dim i, j As Integer
        If ListLeft.Items.Count > 0 Then
            For i = 0 To ListLeft.Items.Count - 1
                ListRight.Items.Add(ListLeft.Items.IndexOf(i))
            Next
        End If
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

fell free to post your problem. many people will give you a hand. :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

hi pooh...Welcome to Daniweb friend :)

november_pooh commented: Thanks +0
Jx_Man 987 Nearly a Senior Poster Featured Poster

he gives a shared code :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

i have tried it. and i don't get result 200.just between 1-199.

Jx_Man 987 Nearly a Senior Poster Featured Poster

you're welcome :)
don't forget to mark this thread solved

Jx_Man 987 Nearly a Senior Poster Featured Poster

try this following code :

{********************************************
  * This Procedure to Sort element vektor *
  * Procedure ATUR to organize an element position *
 ********************************************}
 procedure QUICKSORT (var A : Larik;
                          Awal, Akhir : integer);
 var I,J : integer;

 procedure ATUR;

 begin
 
   I := Aw + 1;
   J := Ak;

 
   while A[I] < A[Aw] do inc(I);


   while A[J] > A[Aw] do dec(J);
   while I < J do

     begin
       TUKARKAN(A[I],A[J]);
       while A[I] < A[Aw] do inc(I); {*To Right*}
       while A[J] > A[Aw] do dec(J); {* TO Left*}
     end;
   TUKARKAN(A[Aw],A[J])
 end;              
 
 begin
   if Aw < Ak then
      begin
        ATUR;
        QUICKSORT(A,Aw,J-1);
        QUICKSORT(A,J+1,Ak)
      end
 end;

Hope this helps...

Jade_me commented: great :) +1
Naruse commented: worked +1
Vega_Knight commented: :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

yeah. i will give u QuickSort procedure

Jx_Man 987 Nearly a Senior Poster Featured Poster

first you must know the type and patern of prime number :
Hope the following code is solved your problem :

Private Sub PrimeNumber(ByVal Low As Integer, ByVal Up As Integer)
        Dim i As Integer
        For i = Low To Up
            If (i = 2) Or (i = 3) Or (i = 5) Or (i = 7) Then 
                ListPN.Items.Add(i)
            Else
                If (i Mod 2 <> 0) And (i Mod 3 <> 0) And (i Mod 5 <> 0) And (i Mod 7 <> 0) Then
                    ListPN.Items.Add(i)
                End If
            End If
        Next
 End Sub

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ListPN.Items.Clear()
        PrimeNumber(txtLower.Text, txtUpper.Text)
End Sub

Hope this helps.
don't forget to give feedback

Jx_Man 987 Nearly a Senior Poster Featured Poster

as ryan said look in controls propeties, the minor one of tab index value will get focus.
ie : text1 - tabIndex = 0 -> this control will get focus
text2 - tabIndex = 1 -> focus after text1
....
or see where the cursor flicker when it run.

Jx_Man 987 Nearly a Senior Poster Featured Poster

oh, you was done. great.
don't forget to mark this solved.
happy coding friend :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

your just have 1 column and index is 0.
selectedItems(0) -> selected item on column 0
selectedItems(1) -> selected item on column 1

Jx_Man 987 Nearly a Senior Poster Featured Poster

and don't forget to stop a server for a while when you want to backup data cause it will give you an error.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Manually you can stop the server copy the data files and then restart the server..

yeah, i do this way if i want to backup my database. i think this is a simple way.:)

Jx_Man 987 Nearly a Senior Poster Featured Poster

Ok. this my connection code.
and don't forget to add the procedure name if you want to call every function that it has connection to database.

Global Conn As ADODB.Connection
Global rs As ADODB.Recordset

Sub Access_Connector()
    Set Conn = New ADODB.Connection
        Conn.Provider = "microsoft.jet.oledb.4.0"
        Conn.CursorLocation = adUseClient
        Conn.Open App.Path & "\SIS.mdb"
End Sub

Hope this helps.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi SubProf... Welcome to Daniweb friend :)
i think you post thread in wrong forum..
this forum for vb not for c#...
please post in current forum -> C#

Jx_Man 987 Nearly a Senior Poster Featured Poster

please see my code :
there are something wrong?how i can check if stack is empty??
NB : isi = content of stack
atas = top of stack
tumpukan is stack

function POP (var T : Tumpukan) : integer;
 begin
        POP := T.Isi[T.Atas];
        T.Atas := dec[T.Atas];
 end;

i was modified your code and add a some code :
i use your initial code...

function POP (var T : Tumpukan) : integer;

 {*this function to check stack is empty or not*}
 function Empty(var T : Tumpukan): boolean;

 begin
   Empty := (T.Atas = 0)
 end;      

 begin
   if Empty(T) then
      POP := 0
   else
      begin
        POP := T.Isi[T.Atas];
        T.Atas := dec[T.Atas];
      end;
 end;

Ok. Hope this helps....

dnk commented: helping much, thanks for empty function. you are really good guy with smart code :) +1
Vega_Knight commented: hei, i get this one too +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

try this following code :

program Reverse_String;

 uses crt;

 const Elemen = 255;   {* Max character *}

 type S255     = string[Elemen];
      Stack = record
                   Input  : S255;
                   Tops : 0..Elemen
                 end;

 var  T       : Stack;  
      I       : integer;   
      StringInput : S255;     

  procedure AWALAN (var T : Stack);

  begin
    T.Tops := 0
  end;        

 
 procedure PUSH (var T : Stack; X : char);

 begin
   T.Tops := T.Tops + 1;
   T.Input[T.Tops] := X
 end;          {* PUSH *}

  function POP (var T : Stack) : char;

  begin
    POP := T.Input[T.Tops];
    T.Tops := T.Tops - 1
  end;         {* POP *}
 {*****************
  * Main program *
  *****************}
  begin
    clrscr;
    Awalan(T);
    writeln('Stack To reverse string');
    writeln('-------------------------------');
    writeln;

    {* String that it want to reverse*}
    write('Input any kind of Strings: ');
    readln(StringInput);

    clrscr;
    writeln('Original Strings:'); writeln(StringInput);

    writeln;writeln('Strings After Reverse:');

    {* push Input strings into Stack *}
    for I := 1 to length(StringInput) do
      PUSH (T, StringInput[I]);

    {* pop Stack Input until Input String reverse*}
    for I := 1 to length(StringInput) do
      write(POP(T));

    writeln
 end.
Jade_me commented: what a wonderful code +1
Naruse commented: nice one... +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

see this code :

Dim sql As String
Private Sub ViewData()
    Set rs = New ADODB.Recordset
        rs.CursorType = adOpenDynamic
        rs.LockType = adLockOptimistic
        rs.Open "SELECT * FROM Login Where UserID = '" & txtUserId.Text & "' AND Password = '" & txtPasw.Text & "'", Conn, , , adCmdText
       
    Set DataGrid1.DataSource = rs
    DataGrid1.Columns(0).Width = 2000
    DataGrid1.Columns(1).Width = 2000
   
    DataGrid1.AllowAddNew = False
    DataGrid1.AllowArrows = True
    DataGrid1.AllowDelete = False
    DataGrid1.AllowUpdate = False
End Sub
Private Sub ViewData2()
    Set rs = New ADODB.Recordset
        rs.CursorType = adOpenDynamic
        rs.LockType = adLockOptimistic
        rs.Open "select * from Login ", Conn
       
    Set DataGrid1.DataSource = rs
    'DataGrid1.Columns(0).Width = 2000
    'DataGrid1.Columns(1).Width = 2000
   
    DataGrid1.AllowAddNew = False
    DataGrid1.AllowArrows = True
    DataGrid1.AllowDelete = False
    DataGrid1.AllowUpdate = False
End Sub
Private Sub btnView_Click()
Access_Connector
Call ViewData
End Sub

Private Sub Form_Load()
Access_Connector
ViewData2
End Sub

ok. Hope this Helps...
don't forget to give feedback...

Sawamura commented: awesome +1
Jade_me commented: great +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi....Jx_Man

Thanks yeah for your reply
but if u dont mind...can u guide me with some sample code
actually i dont know about vb.net much...

Thanks

this code in form 1

Public Shared temp As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer
For i = 1 To 10
ListView1.Items.Add(i)
Next i
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim frm2 As New Form2
    frm2.Show()
End Sub

Private Sub ListView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.Click
    temp = ListView1.SelectedItems(0).Text
    Label1.Text = ListView1.SelectedItems(0).Text
End Sub

this code in form 2 :

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = Form1.temp
End Sub

This an attachment of my code
ListView - Daniweb.zip

Ok. Hope this helps..

Sawamura commented: Mentari +1
Neji commented: great :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

it is using database??