Announcement

Announcement Module
Collapse
No announcement yet.

POST, Analise dan Share Code di sini - VBers

Page Title Module
Move Remove Collapse
This is a sticky topic.
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #61
    Re: POST, Analise dan Share Code di sini - VBers

    Project sample utk code di atas
    use DoEvents() to prevent ur program from freezing while loops

    Comment


    • #62
      Re: POST, Analise dan Share Code di sini - VBers

      Teman-Teman.. Mohon Bantuannya nih...(saya pake VB6)
      1. Saya buat Menu dengan MDI Form... Terus Menunya :
      File
      - Lihat Data (name-nya : MnuLihat)
      - Cetak Data (name-nya : MnuCetak)

      dengan Setting Windows Maximize...
      Kemudian saya pilih menu Lihat Data - > tampil Layar Lihat Data... Kemudian saya pilih menu Cetak Data sehingga tampil Layar Cetak Data (Layar Lihat Data Belum ditutup)... Ketika saya pilih lagi Menu Lihat Data, Kok menu-nya tidak tampil di depan ya...?. Ada yang tau caranya agar ketika saya pilih suatu menu, menu tersebut selalu berada di depan...?

      2. Ada yang tau cara bikin tombol berbentuk elips, kapsul, bintang , dan lainnya ?
      3. ada yang tau forum situs - situs VB..

      Terima Kasih...

      Comment


      • #63
        Re: POST, Analise dan Share Code di sini - VBers

        @Lightzero
        untuk membuat form yang transparan, berbentuk elips dsb coba buka freevbcode.com nanti lihat dibagian graphics..
        Last edited by s1nch4n; 03-03-2006, 07:55.

        Comment


        • #64
          Re: POST, Analise dan Share Code di sini - VBers

          @Lightzero
          =================================================
          1. sewaktu kamu menentukan sebuah attribute form sbg MDIChild dr
          form MDI, maka parent dr form itu akan otomatis pada MDI form yg kamu
          tentukan ( Sama seperti fungsi GetParent dan SetParent API )
          ( this function maybe answer how MDI works : GetParent, SetParent, SetWindowLong ), itulah mengapa Child form hanya bisa dipanggil bila Parent ( MDI form ) already load. untuk masalah kamu coba ShowWindow() API.
          =================================================
          i'll write an example later

          Comment


          • #65
            Re: POST, Analise dan Share Code di sini - VBers

            @Lightzero

            Code:
            '** add to MDI form code panel
            Private Declare Function BringWindowToTop Lib "user32" Alias "BringWindowToTop" (ByVal hwnd As Long) As Long
            
            Private Sub MnuLihat_Click()
                       Call BringWindowToTop(frm_lihat.Hwnd)
            End Sub
            yup, hanya tambahkan sebaris API function ...
            hope solve ur problem

            Comment


            • #66
              Re: POST, Analise dan Share Code di sini - VBers

              tolong dong bantuannya....
              saya ada program tapi kurang bagus, nyaris jelek....
              gini...
              1. Apabila ada barang yang batal dibeli, tekan tombol DELETE maka textbox akan otomatis merapat.
              2. Apabila ada barang yang diretur, maka stock bertambah kembali.
              3. Pada saat pembelian selalu cek apakah ada barang yang dibeli dengan kode yang sama.

              tolong ya bantuannya.....

              Comment


              • #67
                Re: POST, Analise dan Share Code di sini - VBers

                @dragonball
                saya sarankan coba gunakan MsFlexGrid. See sample below ..
                saya lihat kamu sudah menggunakan array untuk object textbox, nah coba gunakan array juga ( sebagai variable ) untuk pengecekan kode item barang.

                hope, solve ur problems

                Comment


                • #68
                  Re: POST, Analise dan Share Code di sini - VBers

                  Searchin an arrays

                  Project ... Add 1 Textbox and name it : tCari and add 1 Listbox, add one Command button name it cClose
                  after that, add this code

                  Code:
                  '============================================================================
                  'An examples Implementing Array Searching with BuiltIn functions [ Filter() ]
                  'Code write at 4 april 2006. Positive+ ( Al )
                  '============================================================================
                  'Have fun and enjoy it ...
                  Option Explicit
                  Option Compare Text
                  Private MyArray() As String
                  Dim j As Integer
                  Private Sub LoadArray()
                  Dim fNum As Integer, buffer As String, sPath As String
                      sPath = App.Path & "\const.txt" '** get file path
                      fNum = FreeFile
                      Open sPath For Binary As fNum ' open file as binary more faster
                           buffer = Space(Fix(LOF(1))) ' creating buffer for contents
                           Get fNum, , buffer 'fill buffer with da file contents
                      Close fNum ' close file
                      MyArray = Split(buffer, vbNewLine) ' now, split into an array
                      List1.Clear ' clear da listbox
                      Me.MousePointer = 11 ' change to busy mouse pointer while adding
                      Do While Not j > (UBound(MyArray) - 1) ' loop and fill to listbox
                         List1.AddItem MyArray(j) ' adding da array values
                         j = j + 1 ' movement
                         DoEvents ' give da code to breath :)
                      Loop
                      Me.MousePointer = 0 ' change da pointer to default when it's done
                      Exit Sub ' exit proc
                  End Sub
                  Private Sub SearchItems(sStr As String)
                  'Params : sStr = Text to Search
                  On Error Resume Next
                  Dim m_result As Variant, xx As Integer
                  Dim IsExist As Boolean
                      sStr = Trim(sStr) ' strip any spaces
                      'now, we filtering da array depends on text to search var _
                       and throwing da result set to another temp array
                      m_result = Filter(MyArray, sStr, True, vbTextCompare)
                      'is array already dimentions ???
                      IsExist = IsNumeric(UBound(m_result))
                      ' if yes, then use it
                      If (IsExist = True) Then
                         List1.Clear ' clear da listbox
                         xx = 1 ' default value
                         Do While Not xx > UBound(m_result) - 1
                             List1.AddItem m_result(xx) ' add da similar one
                             xx = xx + 1 ' movement
                             DoEvents ' give da code to breath :)
                         Loop
                         Erase m_result ' after we use it then destroy it
                      End If
                      Exit Sub
                  End Sub
                  Private Sub cCLose_Click()
                      Erase MyArray ' destroy da array from memory
                      ' close da form with appropriates way
                      Unload Form1 ' unload first, free da memory from this class
                      Set Form1 = Nothing ' then set to nothing
                  End Sub
                  Private Sub tCari_Change(): SearchItems Mid(tCari.Text, 1, Len(tCari.Text)): End Sub
                  Private Sub Form_Load()
                      LoadArray ' load da array result set
                      'centering da form
                      Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 3
                  End Sub
                  Have a nice code then, Positive+

                  Comment


                  • #69
                    Re: POST, Analise dan Share Code di sini - VBers

                    Sorry i'm in a rush when write da code, and forgot to add da files sample that use by da code.

                    Put this [ Const.txt ] file in application path ( app path ) where you save your project files. Below is da files

                    Sorry for that, Positive+

                    Comment


                    • #70
                      Re: POST, Analise dan Share Code di sini - VBers

                      Searchin an array : What da code do ??
                      Note : Just for newbies using an arrays

                      Sekarang kita bahas apa yang code itu lakukan :

                      Option Explicit
                      Semua variable harus di declare -> lebih cepat dan aman
                      Option Compare Text
                      Comparing text [ a .. z ] or [ A .. Z ]
                      Private MyArray() As String
                      General variable private hanya untuk class form ini

                      Procedures :
                      Selain dari comment pada code.

                      Private Sub LoadArray()
                      Procedure ini mengambil seluruh data yang ada pada file Text ( Const.txt ) memasukkan-nya ke dalam buffer array untuk dimanipulasi selama form ini tampil. Mengapa menggunakan Open As Binary methode, well..that's more faster than u open it with ASCII methode.
                      Split () function -> Memecah suatu string ke dalam bentuk array dengan specific delimiter. Hasil dari Split() ini kita tempatkan kedalam variable MyArray. So, karena MyArray() variable adalah dynamic array ... stretching dari pemakaian memory ( Dimentions ) dr array ini akan resize dynamically sesuai dengan hasil Split() function.

                      Private Sub SearchItems(sStr As String)
                      Procedure ini akan mencari string sesuai dengan nilai paramater dari [ sStr ].
                      Filter() function. Bagi yang sudah familiar dengan SQL, this is exactly do like that, except this is untuk [ % values % ] saja
                      Fungsi Filter() ini akan mem-filter dari keseluruhan data dalam MyArray() disesuaikan dengan [ sStr ] parameter values-nya. Result set dari Filter kita masukkan ke dalam temporer dynamic array, loop through it and displayed in listbox. Setelah digunakan hapus array temporer dengan perintah Erase. ini akan menghapus variable array temporer dari memory, karena array bukan-lah suatu object maka berbeda dengan [ Nothing ] yang berguna untuk menghapus suatu var object dari memory.

                      What is Dynamic Array ?
                      i don't like much theories, jadi anggap saja memory adalah sekian banyak kantong karet, var array ditempatkan ke dalam satu kantong karet yang akan memelar sesuai dengan banyak-nya array yg ada, tanpa harus menggunakan kantong karet lainnya lagi

                      samples :
                      Code:
                       
                      Dim MyArray ( 1000 ) as Long
                      '** how much memories will be used ? just multiply da dimentions.
                      '** Long = 4 bytes
                      '** MyArray dimentions is 1000, so it will be [ 1000 ] x 4 Bytes = n 
                      '** so, u can predicted how much memories will be used, for N records.
                      Ok then, hope clear enought

                      Positive+,

                      Comment


                      • #71
                        Re: POST, Analise dan Share Code di sini - VBers

                        Database Code
                        Simple routine to destroy your recordset or connection

                        Code:
                         
                        '** Code write at 5 April 2006, Positive+ ( AL )
                         
                        Private Sub DestroyRec(ByRef R As Recordset)
                            If (Not R Is Nothing) Then
                               If (R.State = AdStateopen) Then R.Close
                               Set R = Nothing
                            End If
                        End Sub
                        
                        Private Sub DestroyCon(ByRef C As Connection)
                            If (Not C Is Nothing) Then
                               If (C.State = AdStateopen) Then C.Close
                               Set C = Nothing
                            End If
                        End Sub

                        Comment


                        • #72
                          Re: POST, Analise dan Share Code di sini - VBers

                          File Existencies function

                          Code:
                           
                          '** Usage : OkB = FileExist("C:\Const.txt") --> return True / False
                          Private Function FileExist(sFile As String) As Boolean
                          Dim a As Integer
                              a = Len(Dir(sFile, 0 Or 1 Or 2 Or 32))
                              FileExist = IIf(a > 0, True, False)
                              Exit Sub
                          End Function
                          Dir Existencies function

                          Code:
                           
                          Private Function DirExist(sDir As String) As Boolean
                          Dim a As Integer
                              a = Len(Dir(sDir, 16))
                              DirExist = IIf(a > 0, True, False)
                              Exit Function
                          End Function
                          Positive+,

                          Comment


                          • #73
                            Re: POST, Analise dan Share Code di sini - VBers

                            How to Deleting file ??

                            Code:
                             
                            Private Sub KillFile(sFile As String)
                                If FileExist(sFile) = True Then
                                   SetAttr sFile, 32
                                   Kill sFile
                                End If
                                Exit Sub
                            End Sub
                            Enjoy and have fun, Positive+

                            Comment


                            • #74
                              Help!! Vb.net 2005

                              hohoo.. napa yaa.. pas nge-run di vb.net 2005 jadi muncul bla2.. "cross-thread" ??? ada yg bisa ngasi solusi ngatasin nya??
                              pdhal cuma
                              Code:
                              ListBox1.Items.Add ("bla..bla..")
                              kalo line itu dimatiin nggak masalah..

                              Comment


                              • #75
                                Re: POST, Analise dan Share Code di sini - VBers

                                If you enabling thread synchronization for controls, try to catch events with
                                BackgroundWorker control to catched da events, kinda hard ... truely i don't code in .NET since i decided for a couple years to stick in classic VB, that's why a bunch of code here write in VB 6.0 , sorry can't give you much help here ... i believe this is multithreading problems, using da BackgroundWorker to handle da events maybe can solved your probs there.

                                Regard

                                Comment

                                Working...
                                X