Click here to Skip to main content
15,901,122 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Whats the meaning of 2 declarations. Pin
ashwath197916-Nov-06 19:16
ashwath197916-Nov-06 19:16 
QuestionHow can i replace all apostrophes on DataSet? Pin
murat_turhan15-Nov-06 23:01
murat_turhan15-Nov-06 23:01 
AnswerRe: How can i replace all apostrophes on DataSet? Pin
_mubashir16-Nov-06 0:27
_mubashir16-Nov-06 0:27 
GeneralRe: How can i replace all apostrophes on DataSet? Pin
murat_turhan16-Nov-06 3:22
murat_turhan16-Nov-06 3:22 
QuestionWhats the meaning of below declarations Pin
ashwath197915-Nov-06 22:28
ashwath197915-Nov-06 22:28 
QuestionIs there something wrong with this line...? Pin
penguin500015-Nov-06 21:57
penguin500015-Nov-06 21:57 
AnswerRe: Is there something wrong with this line...? Pin
Christian Graus15-Nov-06 22:06
protectorChristian Graus15-Nov-06 22:06 
QuestionRe: Is there something wrong with this line...? Pin
penguin500016-Nov-06 10:33
penguin500016-Nov-06 10:33 
Unfortunately, it still isn't working. Is it the way I'm constructing my DataTable? The relevant section is as follows. I'd really appreciate some pointers:

Dim myStreamReader As StreamReader = New StreamReader(txtFilePath.Text)<br />
        Dim strLine As String<br />
        Dim strProdCode As String<br />
        Dim strTransCode As String<br />
        Dim intQuantity As Integer<br />
        Dim intValue As Integer<br />
        Dim intRunningQuantityTotal, intRunningValueTotal As Integer<br />
        Dim intNumberOfRows As Integer<br />
        Dim tblDataTable As New DataTable<br />
<br />
        tblDataTable = New DataTable("TrxContents")<br />
<br />
        Dim colProds As DataColumn = New DataColumn("Product")<br />
        Dim colTrans As DataColumn = New DataColumn("Trans Code")<br />
        Dim colQty As DataColumn = New DataColumn("Quantity")<br />
        Dim colValue As DataColumn = New DataColumn("Value")<br />
        Dim row As DataRow<br />
<br />
        tblDataTable.Columns.Add(colProds)<br />
        tblDataTable.Columns.Add(colTrans)<br />
        tblDataTable.Columns.Add(colQty)<br />
        tblDataTable.Columns.Add(colValue)<br />
<br />
        intRunningQuantityTotal = 0<br />
        intRunningValueTotal = 0<br />
        intNumberOfRows = 0<br />
        intOriginalLines = 0<br />
<br />
        Try<br />
<br />
            Do While myStreamReader.Peek <> -1<br />
                strLine = myStreamReader.ReadLine()<br />
                intOriginalLines = intOriginalLines + 1<br />
<br />
                If strLine.Substring(0, 1) = "K" Then<br />
                    row = tblDataTable.NewRow()<br />
                    intNumberOfRows = intNumberOfRows + 1<br />
<br />
                    'Read the Product Code (start at pos 6. 26 chars long)<br />
                    strProdCode = strLine.Substring(5, 26)<br />
                    row.Item("Product") = strProdCode<br />
<br />
                    'Read the transaction code (start at pos 63. 2 chars long)<br />
                    strTransCode = strLine.Substring(62, 2)<br />
                    row.Item("Trans Code") = strTransCode<br />
<br />
                    'Read the Quantity (start at pos 74. 12 chars long)<br />
                    intQuantity = strLine.Substring(73, 12)<br />
                    row.Item("Quantity") = intQuantity<br />
                    intRunningQuantityTotal = intRunningQuantityTotal + intQuantity<br />
<br />
                    'Read the Value (start at pos 86. 14 chars long)<br />
                    intValue = strLine.Substring(85, 14)<br />
                    row.Item("Value") = intValue<br />
                    intRunningValueTotal = intRunningValueTotal + intValue<br />
<br />
                    tblDataTable.Rows.Add(row)<br />
<br />
                End If<br />
<br />
            Loop<br />
            myStreamReader.Close()<br />
<br />
            Dim ds As New DataSet<br />
            ds = New DataSet<br />
<br />
            Dim totValue As Integer = Convert.ToInt32(tblDataTable.Compute("Sum(Value)", "Product = 'P199'"))<br />
            MessageBox.Show(totValue)<br />
<br />
            ds.Tables.Add(tblDataTable)<br />
            Me.grdDataGrid.SetDataBinding(ds, "TrxContents")<br />
<br />
        Catch<br />
<br />
                ... some stuff<br />
<br />
        End Try


Thanks in advance.
AnswerRe: Is there something wrong with this line...? Pin
Christian Graus16-Nov-06 10:37
protectorChristian Graus16-Nov-06 10:37 
GeneralRe: Is there something wrong with this line...? Pin
penguin500016-Nov-06 12:25
penguin500016-Nov-06 12:25 
GeneralRe: Is there something wrong with this line...? Pin
Christian Graus16-Nov-06 12:27
protectorChristian Graus16-Nov-06 12:27 
Questionvb.net - ORACLE Pin
FeRtoll15-Nov-06 20:30
FeRtoll15-Nov-06 20:30 
AnswerRe: vb.net - ORACLE Pin
b43r_3oo315-Nov-06 22:32
b43r_3oo315-Nov-06 22:32 
QuestionDatagrid Pin
Subjugate15-Nov-06 20:15
Subjugate15-Nov-06 20:15 
AnswerRe: Datagrid Pin
Tamimi - Code15-Nov-06 20:23
Tamimi - Code15-Nov-06 20:23 
GeneralRe: Datagrid Pin
Subjugate15-Nov-06 20:58
Subjugate15-Nov-06 20:58 
GeneralRe: Datagrid Pin
Tamimi - Code15-Nov-06 21:39
Tamimi - Code15-Nov-06 21:39 
GeneralRe: Datagrid Pin
Subjugate15-Nov-06 22:15
Subjugate15-Nov-06 22:15 
GeneralRe: Datagrid Pin
Johan Hakkesteegt16-Nov-06 4:15
Johan Hakkesteegt16-Nov-06 4:15 
QuestionWindows Media Player Control Pin
Kevnar15-Nov-06 18:37
Kevnar15-Nov-06 18:37 
AnswerRe: Windows Media Player Control Pin
MatrixCoder19-Nov-06 22:06
MatrixCoder19-Nov-06 22:06 
QuestionVB.NET (ActiveX web browser control) Pin
gspowar15-Nov-06 17:54
gspowar15-Nov-06 17:54 
QuestionNetwork-Database Programming How to Pin
sitt15-Nov-06 17:41
sitt15-Nov-06 17:41 
AnswerRe: Network-Database Programming How to Pin
Johan Hakkesteegt17-Nov-06 6:08
Johan Hakkesteegt17-Nov-06 6:08 
QuestionListView Pin
momooomooomomo15-Nov-06 16:02
momooomooomomo15-Nov-06 16:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.