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

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

    Hi Dewaputra ... this what i've done

    Code:
    
    Option Explicit
    
    '/ i'm makin it as Procedure
    Sub view_rpt(iNum As Integer) '/ fill the parameter values with ListBox Listindex
    '* I HAVEN'T TESTED THIS PROC, so tell me if there's somethin wrong ( i don't have any C.Report install on ma computer )
    Dim Report As New CrystalReport1 '/ use as local var in this proc
    Dim sBuff As String
        Screen.MousePointer = vbHourglass '/ change to busy mouse pointer
        '** it should be there's set up for .DataFiles(x), Database etc properties
        '// before this line
        Select Case iNum '/ put query into variable sBuff
            Case 0
                 '/ try usin  and try to make it as Variable..more save, Mmm...it will look like this
                 'sBuff = "{Quatity.Date} BETWEEN ..... AND .....
                 sBuff = "{Quatity.Date} in DateTime (" & FrmRep.TxtTh.Text & "," & FrmRep.CmbBln.Text & "," & FrmRep.CmbTgl.Text & ") to DateTime (" & FrmRep.TxtTh1.Text & "," & FrmRep.CmbBln1.Text & "," & FrmRep.CmbTgl1.Text & ")"
            Case 1
                 sBuff = "select * from quatity order by draw_no" 'sort report ascending with draw_no field
            Case 2
                 sBuff = "select * from quatity order by customer" 'sort report ascending with customer field
            Case 3
                 sBuff = "select * from quatity order by proses" 'sort report ascending with proses field
            Case 4
                 sBuff = "select * from quatity order by job_no" 'sort report ascending with job_no field
            Case 5
                 sBuff = "select * from quatity order by opt_id" 'sort report ascending with opt_id field
        End Select
        
        '** the rem code below, use for passing selection formula to Report Obj
        '-> this code -> Report.DataDefinition.RecordSelectionFormula = sBuff
        Report.DataDefinition.RecordSelectionFormula = sBuff
        '** if you want to passing selection formula by Viewer Control
        '-> this code -> CRViewer1.SelectionFormula = sBuff
        
        '// after we select the record, then set to viewer source properties
        CRViewer1.ReportSource = Report
        '// viewing the rpt
        CRViewer1.ViewReport
        '// change MP to default again
        Screen.MousePointer = vbDefault
        '// Mmm...try it first, bye
    End Sub
    Private Sub Form_Load()
        'Screen.MousePointer = vbHourglass
        'CRViewer1.ReportSource = Report <- it will view with default source, that is ( * ) all
        'Screen.MousePointer = vbDefault <- should be write after all process has been done
        'Select Case FrmRep.CmbFilter.ListIndex <- for this till END SELECT, try with above..to passing the selection
        '    Case 0
        '        Report.RecordSelectionFormula = "{Quatity.Date} in DateTime (" & FrmRep.TxtTh.Text & "," & FrmRep.CmbBln.Text & "," & FrmRep.CmbTgl.Text & ") to DateTime (" & FrmRep.TxtTh1.Text & "," & FrmRep.CmbBln1.Text & "," & FrmRep.CmbTgl1.Text & ")"
                 '// it will be done (viewing your record) if you add this line below _
                     CRViewer1.ReportSource '// but, this is for the second time you'll write it
        '        CRViewer1.ViewReport
        '    Case 1
        '        Report.SQLQueryString = "select * from quatity order by draw_no" 'sort report ascending with draw_no field
        '        CRViewer1.ViewReport
        '    Case 2
        '        Report.SQLQueryString = "select * from quatity order by customer" 'sort report ascending with customer field
        '        CRViewer1.ViewReport
        '    Case 3
        '        Report.SQLQueryString = "select * from quatity order by proses" 'sort report ascending with proses field
        '        CRViewer1.ViewReport
        '    Case 4
        '        Report.SQLQueryString = "select * from quatity order by job_no" 'sort report ascending with job_no field
        '        CRViewer1.ViewReport
        '    Case 5
        '        Report.SQLQueryString = "select * from quatity order by opt_id" 'sort report ascending with opt_id field
        '        CRViewer1.ViewReport
        'End Select
        
        'the problem is :
        '-> i don't see any line that set the DataFiles(x) or else properties
        '-> all u want is to select the records, but you have set the report source first _
            Report.RecordSelectionFormula = ".." <- it should be first, then _
            CRViewer1.ReportSource = Report <- this line after above has been done
        view_rpt FrmRep.CmbFilter.ListIndex
    End Sub
    Private Sub Form_Resize()
        If WindowState <> 1 Then
           '/ use .Move more effecient and faster _
              rather than setting up the rect prop (  .left, .top, .width, .height )
           CRViewer1.Move 0, 0, ScaleWidth, ScaleHeight
        End If
    End Sub
    

    the different with passing the formula :
    -> Passing Selection to Report Object, you select the records first then view the result with Viewer Ctrl
    Report.DataDefinition.RecordSelectionFormula = sBuff
    -> Passing Selection to Viewer Object, the report has been there in viewer obj. ( at real time )
    CRViewer1.SelectionFormula = sBuff
    other suggest :
    Try copy your selection formula to the seagate crystal report program and use the record selection formula to test the formula. Most of the time the error you encounter it due to the report to have the field your try to refer with

    Last edited by positive+; 27-10-2005, 20:48.

    Comment


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

      Originally posted by Dewaputra
      plissss, analise this code
      n tell me where I've done wrong!!
      kita sama2 belajar... ok
      coba programnya di upload ya...

      Comment


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

        masalahnya pada awal sebelum SELECT CASE statement Dewa menulis ini :
        -> CRViewer1.ReportSource = Report ( yang tentunya akan menampilkan seluruh data yg ada tanpa selection / default )
        -> dan dalam CASE (index) , Dewa membuat seleksi data yg akan ditampilkan, line ini :
        Code:
        Case (index)
        Report.RecordSelectionFormula = "bla ..."
        CRViewer1.ViewReport
        kalaupun data dr report dapat ditampilkan, itu pasti bukan hasil dr selectionFormula-nya yg ada dlm CASE krn ReportSource tidak di-update setelah Selection Formula, utk penulisan yg benar seharusnya spt ini :
        Code:
        Report.RecordSelectionFormula = "bla..bla"
        CRViewer1.ReportSource = Report
        CRViewer1.ViewReport
        sedangkan bila mengikuti Logic penulisan dr Dewaputra, maka akan hrs tertulis spt ini :
        Code:
        CRViewer1.ReportSource = Report '// i dunno why Dewa's write this before SELECT CASE
        Report.RecordSelectionFormula = 
        "bla..bla.." '// coz, then he make selection for Report data with this line
        '// the selection will be executed, but the report source never change coz he's not write it again
        CRViewer1.ReportSource = Report '// so, this line existence make it more logical for me, but not efficient to the way we must write the program
        CRViewer1.ViewReport
        that's what i think. CMIIW
        btw, i forgot to ask
        .....pi ga jalan2 dimana letak kesalahannya??
        maksudnya, apakah data yg di-inginkan setelah Selection yg ngga jalan ? ato blank sama sekali ??
        krn bila melihat dari coding Dewa di atas, asumsi saya hasil dr Selection formula yg ngga jalan ?

        once again CMIIW, we'll wait for Dewa's replies
        Last edited by positive+; 26-10-2005, 22:52.

        Comment


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

          Tnx, bgt nih buat pencerahannya

          kebetulan VB saya lgi ngadat, saya coba install ulang pi keluar pesan :

          Error installing SQL odbc driver

          jdi saya blom bisa coba codingnya, kira2 ada yang tau ga solusi untuk permasalahan tersebut? untuk bang Positive+ tnx bgt buat logicnya, sudenly saya mendapat pencerahannya.

          Buat bang Positive+ maksudnya ga jalan2, setiap saya run dngan ful compile, slalu ada pesan error :

          Compiler error
          invalid use of method bla....

          di LOC Report.recordselectionformula

          Tnx untuk semua, nanti klo VB saya dah sehat lgi n saya bisa coba codingnya saya akan inform lagi gmana hasilnya

          best regards,

          Comment


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

            main game puzzle yuk....
            masih sederhana banget ni.....
            terbuka buat dianalisa .....

            Code:
            
            Dim numPict As Byte
            Dim pictIndex As Integer
            Dim myTempl(47) As Integer
            
            Private Sub TemplPict()
            Dim h As Byte
            Dim pictLeft, pictTop
            pictLeft = 200
            pictTop = 100
            
            For h = 0 To 47
             Load Picture2(h)
             Picture2(h).Left = pictLeft
             Picture2(h).Top = pictTop
             pictLeft = pictLeft + 80
             If pictLeft > 760 Then
              pictLeft = 200
              pictTop = pictTop + 80
             End If
             Picture2(h).Visible = True
            Next h
            End Sub
            
            Private Sub AcakPict()
            Dim imgX As ListImage
            Static xxx As Integer
            Static yyy As Integer
            xxx = 0
            yyy = 0
            
            ImageList1.ListImages.Clear
            
            Dim X As Integer
            For X = 0 To 47
            
             Picture2(X).PaintPicture Picture1.Picture, 0, 0, 80, 80, 80 * xxx, 80 * yyy, 80, 80
             xxx = xxx + 1: If xxx = 8 Then xxx = 0: yyy = yyy + 1
             Set imgX = ImageList1.ListImages.Add(X + 1, , Picture2(X).Image)
             DoEvents
            Next X
            
            Erase myTempl
            
            Dim Y As Byte
            Dim z As Long
            For Y = 0 To 47
             Picture2(Y).Cls
            upp:
             Randomize
             z = Rnd * 47
             If myTempl(z) = 777 Then GoTo upp
             Picture2(Y).Picture = ImageList1.ListImages(z + 1).ExtractIcon
             myTempl(z) = 777
             DoEvents
            Next Y
            End Sub
            
            Private Sub Form_Load()
            TemplPict
            AcakPict
            End Sub
            
            Private Sub Picture2_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
            If Button <> vbLeftButton Then
               Exit Sub
            End If
            
            If MousePointer = 0 Then
             MouseIcon = Picture2(Index).Picture
             MousePointer = 99
             Picture2(Index) = Picture3.Picture
             pictIndex = Index
            ElseIf MousePointer = 99 Then
             Picture2(pictIndex) = Picture2(Index)
             Picture2(Index) = MouseIcon
             MousePointer = 0
            End If
            End Sub
            

            Comment


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

              Hi... Gua masih newbie banget nih di VB...
              Tolong bantuin yach... Gua mau bikin game puzzle...
              Gimana cara pindahin gambarnya? Ini gua dah bikin listing codenya, tapi masih yang sederhana, cuma mindahin caption dari satu command button ke command button lainnya..
              Yang gua mau, kalo ada gambar, gimana cara mindahin gambar dari satu cmd button ke cmd button lainnya?
              Trus.. Gimana cara random semua gambarnya nanti?
              Bantuin yach... Thanks...

              Comment


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

                Ianosphere, take a look at Harno's sample ...

                Comment


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

                  Dewa
                  Compiler error
                  invalid use of method bla....
                  di LOC Report.recordselectionformula
                  lihat thread sebelumnya, mengenai passing Selection Formula.

                  Comment


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

                    DatabasesConnectionString
                    ADO Databases Programming

                    Back from surfing
                    Thought this is one from all great site that provided database connection
                    string for us to collect.

                    Here it is the site

                    Cheers for Google, Positive+

                    Comment


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

                      Hmm...ada yg mau suggest utk thread yg di-inginkan

                      Comment


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

                        Hai.. VBers... Nanya donk..
                        kalo gua mau masukin background music di program gua gimana caranya?
                        thanks yach..

                        Comment


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

                          Hi Ianosphere
                          Pernah menggunakan API ( Application Programming Interface ) ?
                          ini salah satu sample dasar dari fungsi API menggunakan sndPlaySound function ( API - OS use NT ) :

                          Code:
                          '// Tempatkan pada form code 
                          '// ============================================
                          '// Function Parameter desc : 
                          '// ============================================
                          '// lpszSoundName As String  <-- File Path specified
                          '// ByVal uFlags As Long  <-- Flags
                          '// ============================================
                          
                          Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long 
                          
                          Sub Play_Sound( sPath as String ) 
                          '// kembangkan prosedur ini bila kamu mau :D
                          Dim mVar as Long
                          '// da sound will be played till it must finish, depend on your Flag's
                          
                             mVar = sndPlaySound (sPath, 1)
                          
                          End Sub
                          
                          '// Sample Procedure called usage ---> Play_Sound "C:\sound.wav"
                          Dan masih banyak cara untuk maksud yg kamu inginkan. Bisa menggunakan
                          DirectX function ( Advance Game Programming ), API ( Seperti di atas ), dengan component Windows Media Player etc.
                          Mengapa harus menggunakan prosedur utk code yg hanya sebaris di atas ?
                          Lebih kepada Handle dan managing program kamu nantinya, error detection lebih mudah dan terarah, utk pengembangan code juga lebih baik. For Further Usage, bayangkan bila semua harus bercampur baur dengan code lainnya, selain kotor, kamu juga akan pusing sendiri saat harus menambah ato merubah lainnya. Give your comments later OK

                          Positive+,

                          Comment


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

                            RichTextBoxControl

                            Playing with System API and RichTextBox

                            Set Scrollbar Properties of RichTextBox Control to 3 - rtfBoth and
                            add this code

                            Code:
                            Option Explicit
                            
                            
                            Const WM_USER = &H400
                            Const EM_SETTARGETDEVICE = (WM_USER + 72)
                            Private Declare Function SendMessageLong Lib "user32" _
                                    Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
                            ByVal wParam As Long, ByVal lParam As Long) As Long
                            
                            Private Sub Form_Load()
                                SendMessageLong rtfText.hwnd, _
                                                EM_SETTARGETDEVICE, _
                                                Printer.hDC, _
                                                Printer.Width
                                
                            End Sub


                            Have a nice day everyone, Positive+
                            Last edited by positive+; 28-11-2005, 22:30.

                            Comment


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

                              Originally posted by positive+
                              Hmm...ada yg mau suggest utk thread yg di-inginkan
                              Hm..boleh minta thread ttg C ato C++ ?

                              Comment


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

                                Eh nanya donx,
                                ﺱﺱﺱﺱﺴﺴﺮﻙﺶﺛﺛﺞﺛﺯﻰﻲﻶ



                                Gimana nih cara ngebuat Ballon Message? Kalo bisa source codenya VB .NET 2003. Pleaseee URGENT NEH!!!

                                ________________
                                Ballon message yang kaya' di Windows XP, dari tray icon trus nongol tuh Ballon Message
                                Last edited by mupit; 15-12-2005, 15:14. Reason: Tidak Pernah dibalas

                                Comment

                                Working...
                                X