Welcome back, Guest!
Register
Forgot your Password?
Page 2 of 1268 FirstFirst 123412521025021002 ... LastLast
Results 11 to 20 of 12675
  1. #11

    Default Re: VB.NET Programming Corner!

    Quote Originally Posted by ericgmejia View Post
    First Post:

    Populating DataGridView using MSAccess Database



    Shown in 3ways
    -using Dataset
    -using DataReader
    -binding the DataGridView to a dataset



    Important points to learn:
    OleDBConnection
    OleDBCommand
    OleDBAdapter
    Dataset
    DataReader
    DataTable
    Using My.Settings to save the database path

    Program will search for the database if not found;
    Sample code has comments as to how it is done
    Post further questions if necessary:

    Basic Steps:

    Create a project:
    Add a form:
    Add this to the forms top most code
    "Imports System.Data.OleDb"
    Add the DataGridView
    For non databound grid,
    add the necessary columns using the datagridview designer (when selected; click the [>] button on the top rigth of the grid)
    Follow the code provided


    the file
    ericVBNETAccess.rar
    contains the design for the application series i wanted to construct for this thread
    you will notice, walang pop windows, nasa tab page lang ang forms.
    stay tuned to know how it is done.
    medyo mahaba po yung code 'nyo, ewan ko kung best ba ito. Meron po akong ibang way.. Sunday kasi ngayon, nasa net cafe lang ako.. bukas, i.upload ko dito yung code ko in populating datagrid as ms access as backend! Wala kasi Visual Studio dito..

  2. #12

    Default Re: VB.NET Programming Corner!

    Quote Originally Posted by ako2 View Post
    medyo mahaba po yung code 'nyo, ewan ko kung best ba ito. Meron po akong ibang way.. Sunday kasi ngayon, nasa net cafe lang ako.. bukas, i.upload ko dito yung code ko in populating datagrid as ms access as backend! Wala kasi Visual Studio dito..
    as i said i presented 3 ways to do it, look at method3.

    malamang naka bound ka sa isang design time datasource. i dont do that,
    wala masyado control sa runtime pag ganun.
    madami ka di pde gawin pag naka bound na yung grid.
    which you will see as the samples progress.

    what im showing here is also applicable to other controls not just datagridview.
    and i want to show rin how it is done in code

    the code is not only for datagridview, you can use the code in other operations as well.

    if you have a better code to share then tignan natin, you can open your file naman sa notepad muna so we can see it.
    baka di ko pa alam yang method mo.
    share tayo ng mag codes and techniques. this is what this forum is for.
    Last edited by ericgmejia; 20th Jun 2010 at 15:10.

  3. #13

    Default Re: VB.NET Programming Corner!

    thanks po master..

  4. #14

    Default Re: VB.NET Programming Corner!

    Question po, I made a class for reading and sending text messages and in that class I have a windows.forms.timer it is working perfectly fine so i tried to compile it as a class library and changed the windows.forms.timer to system.timers.timer when i tried to use it on the same program it has an error "Stack Overflow".

    for people who don't know the difference between windows.forms.timer and system.timers.timer is windows.forms.timer can only be used on windows forms. surprised? hehehe

    is there a difference on their behavior?

  5. #15

    Default Re: VB.NET Programming Corner!

    Quote Originally Posted by doorbreaker View Post
    Question po, I made a class for reading and sending text messages and in that class I have a windows.forms.timer it is working perfectly fine so i tried to compile it as a class library and changed the windows.forms.timer to system.timers.timer when i tried to use it on the same program it has an error "Stack Overflow".

    for people who don't know the difference between windows.forms.timer and system.timers.timer is windows.forms.timer can only be used on windows forms. surprised? hehehe

    is there a difference on their behavior?
    dapat hindi windows.Forms.Timer ang ginamit mo

    try mo to
    Code:
    Public Class TimerClas
        Dim cTime As New Timer
    
        Friend Sub New(ByVal Interval As Long)
            cTime.Interval = Interval
            AddHandler cTime.Tick, AddressOf TimerEvent
        End Sub
    
        Friend Sub TimerStart()
            cTime.Start()
        End Sub
    
        Friend Sub TimerStop()
            cTime.Stop()
        End Sub
    
        Friend ReadOnly Property TimeElapsed() As Integer
            Get
                Dim nElapsed As Integer
                Return nElapsed
            End Get
        End Property
    
        Private Sub TimerEvent()
            'dito mag TICK ang timer
    
        End Sub
    End Class

  6. #16

    Default Re: VB.NET Programming Corner!

    Quote Originally Posted by ericgmejia View Post
    dapat hindi windows.Forms.Timer ang ginamit mo

    try mo to
    Code:
    Public Class TimerClas
        Dim cTime As New Timer
    
        Friend Sub New(ByVal Interval As Long)
            cTime.Interval = Interval
            AddHandler cTime.Tick, AddressOf TimerEvent
        End Sub
    
        Friend Sub TimerStart()
            cTime.Start()
        End Sub
    
        Friend Sub TimerStop()
            cTime.Stop()
        End Sub
    
        Friend ReadOnly Property TimeElapsed() As Integer
            Get
                Dim nElapsed As Integer
                Return nElapsed
            End Get
        End Property
    
        Private Sub TimerEvent()
            'dito mag TICK ang timer
    
        End Sub
    End Class
    ito po code ko
    Code:
    public ctimer as system.timers.timer
    sub new()
    
    AddHandler ctimer.Elapsed, AddressOf DOSOMETHING()
    ctimer.interval = 1000
    ctimer.start
    end sub
    
    private sub DOSOMETHING
     'something
    end sub

    san po kinuha ung timer nyo? ang alam ko lang po kasi

    windows.forms.timer
    system.timers.timer
    threading.timer
    Last edited by doorbreaker; 21st Jun 2010 at 14:19.

  7. #17

    Default Re: VB.NET Programming Corner!

    Quote Originally Posted by doorbreaker View Post
    ito po code ko
    Code:
    public ctimer as system.timers.timer
    sub new()
    
    AddHandler ctimer.Elapsed, AddressOf DOSOMETHING()
    ctimer.interval = 1000
    ctimer.start
    end sub
    
    private sub DOSOMETHING
     'something
    end sub

    san po kinuha ung timer nyo? ang alam ko lang po kasi

    windows.forms.timer
    system.timers.timer
    threading.timer

    Forms.Timer yan, gumagamit ng Tick e

    eto try mo mas ok

    Code:
    Imports System
    Imports System.Timers
    
    Public Class Timer1
    
        Private xTimer As System.Timers.Timer
    
        Public Shared Sub Main()
            ' Create a timer with a ten second interval.
            xTimer = New System.Timers.Timer(10000)
    
            ' Hook up the Elapsed event for the timer.
            AddHandler xTimer.Elapsed, AddressOf OnTimerEvent
    
            ' Set the Interval to 2 seconds (2000 milliseconds).
            xTimer.Interval = 2000
            xTimer.Enabled = True
    
            Console.WriteLine("Press the Enter key to exit the program.")
            Console.ReadLine()
    xTimer.AutoReset
       End Sub
    
        ' Specify what you want to happen when the Elapsed event is 
        ' raised.
        Private Shared Sub OnTimerEvent(source As Object, e As ElapsedEventArgs)
            Console.WriteLine("The Elapsed event was raised at {0}", e.SignalTime)
        End Sub
    End Class
    
    'Output:
    '
    'Press the Enter key to exit the program.
    'The Elapsed event was raised at 5/20/1900 8:42:27 PM
    'The Elapsed event was raised at 5/20/1900 8:42:29 PM
    'The Elapsed event was raised at 5/20/1900 8:42:31 PM
    '...
    Last edited by ericgmejia; 21st Jun 2010 at 14:48.

  8. #18

    Default Re: VB.NET Programming Corner!

    Quote Originally Posted by ericgmejia View Post
    Forms.Timer yan, gumagamit ng Tick e

    eto try mo mas ok

    Code:
    Imports System
    Imports System.Timers
    
    Public Class Timer1
    
        Private xTimer As System.Timers.Timer
    
        Public Shared Sub Main()
            ' Create a timer with a ten second interval.
            xTimer = New System.Timers.Timer(10000)
    
            ' Hook up the Elapsed event for the timer.
            AddHandler xTimer.Elapsed, AddressOf OnTimerEvent
    
            ' Set the Interval to 2 seconds (2000 milliseconds).
            xTimer.Interval = 2000
            xTimer.Enabled = True
    
            Console.WriteLine("Press the Enter key to exit the program.")
            Console.ReadLine()
    xTimer.AutoReset
       End Sub
    
        ' Specify what you want to happen when the Elapsed event is 
        ' raised.
        Private Shared Sub OnTimerEvent(source As Object, e As ElapsedEventArgs)
            Console.WriteLine("The Elapsed event was raised at {0}", e.SignalTime)
        End Sub
    End Class
    
    'Output:
    '
    'Press the Enter key to exit the program.
    'The Elapsed event was raised at 5/20/1900 8:42:27 PM
    'The Elapsed event was raised at 5/20/1900 8:42:29 PM
    'The Elapsed event was raised at 5/20/1900 8:42:31 PM
    '...


    i think na solve ko na po problem ko. sana you can support me sa observation ko. ganto po un

    windows.forms.timers inaantay nya matapos ung buong procedure na nkalagay sa tick event nya before mag trigger ulit incase na hindi pa tapos ang event eh tapos na interval.

    system.timers.timer trigger ng trigger ang events based on interval kahit na hindi pa tapos ang procedures.

    tama po ba observation ko?

  9. #19

    Default Re: VB.NET Programming Corner!

    Quote Originally Posted by doorbreaker View Post
    i think na solve ko na po problem ko. sana you can support me sa observation ko. ganto po un

    windows.forms.timers inaantay nya matapos ung buong procedure na nkalagay sa tick event nya before mag trigger ulit incase na hindi pa tapos ang event eh tapos na interval.

    system.timers.timer trigger ng trigger ang events based on interval kahit na hindi pa tapos ang procedures.

    tama po ba observation ko?
    tama, asynchronous ang timer, supposed to be
    pero nasa same thread sila ng task mo,

    The System.Windows.Forms.Timer runs on the same thread as the application.
    So if your application is carrying out some processor-intensive task, the
    timer ticks are not going to be fired since the thread is busy doing your
    task. Instead, use the System.Timers.Timer (which runs on a seperate thread
    than the application) and write your code in the Elapsed event of the timer.
    pag System.Timers;
    mag tick ulit yan basta inabutan ng interval, walang pakialam kung may ginagawa pa sa loob ng tick event.

    kung gusto mo tapusin yung task, i stop/disable mo muna yung timer, then after ng task, saka ka mag start/enable ulit para synchronized
    Last edited by ericgmejia; 21st Jun 2010 at 16:27.

  10. #20

    Default Re: VB.NET Programming Corner!

    Quote Originally Posted by ericgmejia View Post
    tama, asynchronous ang timer

    mag tick ulit yan basta inabutan ng interval, walang pakialam kung may ginagawa pa sa loob ng tick event.

    kung gusto mo tapusin yung task, i stop/disable mo muna yung timer, then after ng task, saka ka mag start/enable ulit
    thanks po ok na prob ko.

Similar Threads

  1. C# .NET Programming Corner
    By shalnark04 in forum Programming & Web Design
    Replies: 17
    Last Post: 15th Jun 2017, 17:52
  2. VB.NET Programming Corner
    By glaidcm in forum Programming & Web Design
    Replies: 1
    Last Post: 1st Oct 2012, 10:10
  3. [HELP!] VB.net Programming
    By blackjack in forum Programming & Web Design
    Replies: 0
    Last Post: 22nd Oct 2009, 09:39
  4. Replies: 27
    Last Post: 11th Aug 2009, 07:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •