how to create a temp table and store it as a global variable? (easy points)

Posted on 2007-08-08
Last Modified: 2013-11-05
hi all,
I have the following code:

  Private Sub cmdMiscellaneous_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdMiscellaneous.Click

        Dim dt As New DataTable
        dt =
        Dim dtrw As DataRow
        dtrw = dt.Rows(0)
        For Each dtrw In dt.Rows
            Dim pattern As String = "T\d{2}"
            For Each m As Match In Regex.Matches(strRights, pattern)
                If dtrw(3) = m.Value Then
                    MsgBox("Table Name: " & dtrw(2) & vbCrLf & "Form Name: " & dtrw(4))
                 End If

    End Sub

and what i need to do is to create a tmp datatable and store as a global variable for this i have set up a global variable called:

Public dtTemp As DataTable

how can i do this?
Question by:jsctechy
    LVL 96

    Accepted Solution

    Create table and columns:

    dtTemp = New DataTable("Matches)

    Add a row:

     If dtrw(3) = m.Value Then
        Dim dr As DataRow = dtTemp.NewRow()
       dr("TableName") = dtrw(2)
       dr("FormName") = dtrw(4)
    End If

    LVL 1

    Author Comment

    so this code goes instead of the msgbox()  
    LVL 1

    Author Comment

    also how can i display the values that dttemp holds after the execution?
    LVL 96

    Expert Comment

    by:Bob Learned
    Yes, no MsgBox.

    For Each dr As DataRow In dtTemp.Rows
       For Each dc As DataColumn In dtTemp.Columns
       Next dc
    Next dr


    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now