Hi i have a datatable. I have the following code. Is there a way that i can set the datarows to a module so that i can easily recall them. At the moment every calculation that is made i need to identify the datarows ie
Dim row1 as datarow = dt.rows(0)

I have tried putting these at the top of the code but no luck.


        Function ADD(ByVal a As Single, ByVal b As Single) As Single

        Dim c As Single
        c = a + b
        Return c

        End Function

        'Can i move these to a module?

        Dim row1 As DataRow = dt.Rows(0)
        Dim row2 As DataRow = dt.Rows(1)
        Dim row3 As DataRow = dt.Rows(2)

        row3("C") = add(Row1("A"),row2("B")
5 Years
Discussion Span
Last Post by tinstaafl

where is dt inititalized? You can easily do it. It's the same as putting it at the front of your code. But if dt can't be read then it won't work. There's a pretty good post on global variables here

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.