Click here to Skip to main content
15,918,050 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Cannot inherits Image class?????? Pin
Guffa5-May-06 4:53
Guffa5-May-06 4:53 
AnswerRe: Cannot inherits Image class?????? Pin
Dave Kreskowiak5-May-06 6:31
mveDave Kreskowiak5-May-06 6:31 
Question<b>Tranlation of New Event<b> Pin
eatwork4-May-06 12:16
eatwork4-May-06 12:16 
AnswerRe: Tranlation of New Event Pin
Dave Doknjas5-May-06 14:05
Dave Doknjas5-May-06 14:05 
GeneralRe: Tranlation of New Event Pin
eatwork8-May-06 5:37
eatwork8-May-06 5:37 
GeneralRe: Tranlation of New Event Pin
Dave Doknjas8-May-06 6:03
Dave Doknjas8-May-06 6:03 
QuestionNeed help getting info out of my sortedlist Pin
crash8934-May-06 10:32
crash8934-May-06 10:32 
AnswerRe: Need help getting info out of my sortedlist Pin
crash8934-May-06 10:36
crash8934-May-06 10:36 
<br />
Imports System.IO<br />
Imports System.Text.Encoding<br />
Imports System.Text.RegularExpressions<br />
<br />
Public Class Form1<br />
<br />
    Private Sub ExitToolStripMenuItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click<br />
        Me.Close()<br />
    End Sub<br />
<br />
    Private strSourcePath As String<br />
    Dim ipassinfo As New SortedList<br />
    Public Structure user<br />
        'Declare data members<br />
        Public username As String<br />
        Public department As String<br />
        Public domestictotal As Decimal<br />
    End Structure<br />
    Dim userinfo As New user<br />
    Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click<br />
        Tb_totals.Clear()<br />
        tb_usertotals.Clear()<br />
        tb_linesproccessed.Clear()<br />
<br />
<br />
        With Me.OpenFileDialog1<br />
            .InitialDirectory = "C:\"<br />
            ' The file could be of any type. The Filter is restricted to Text Format <br />
            ' files only for demonstration purposes.<br />
            .Filter = "Tab delmited (*.csv)|*.csv"<br />
            .FilterIndex = 1<br />
<br />
            ' The OpenFileDialog control only has an Open button, not an OK button.<br />
            ' However, there is no DialogResult.Open enum so use DialogResult.OK.<br />
            If .ShowDialog() = Windows.Forms.DialogResult.OK Then<br />
                strSourcePath = .FileName<br />
<br />
<br />
                Dim datipass As New StreamReader(.FileName)<br />
                '*'' Dim totalChargeByName As New SortedList<br />
                Dim fields As String()<br />
                Dim count As Int16<br />
<br />
                Do Until datipass.Peek() = -1<br />
                    Dim MyLine As String = datipass.ReadLine<br />
                    Dim myparse As String<br />
<br />
                    'create variable for "'"<br />
                    myparse = (ControlChars.Quote & "," & ControlChars.Quote)<br />
                    'Replace "," with tab's<br />
                    MyLine = MyLine.Replace(myparse, ControlChars.Tab)<br />
                    'remove certian words<br />
                    MyLine = MyLine.Replace("usatoday\", "")<br />
                    MyLine = MyLine.Replace("eu\", "")<br />
                    'forces everythign to lower<br />
                    MyLine = MyLine.ToLower<br />
                    'break feild up on tabs<br />
                    fields = MyLine.Split(ControlChars.Tab) 'Or Convert.ToChar(Keys.Tab)<br />
<br />
<br />
                    'check to see if entrie already exists if not create it<br />
                    If ipassinfo(fields(2)) Is Nothing Then<br />
                        'loading the structure<br />
                        userinfo.username = fields(2)<br />
                        userinfo.department = "???"<br />
                        userinfo.domestictotal = fields(9)<br />
                        'adding the structure to the sortedlist under key username<br />
                        ipassinfo.Add((fields(2)), userinfo)<br />
                    Else<br />
                        ' adds charges to total if allready exists<br />
                        userinfo.domestictotal = userinfo.domestictotal + fields(9)<br />
                    End If<br />
                    count = count + 1<br />
                Loop<br />
                Me.tb_linesproccessed.Text = count<br />
                'release the access of the file<br />
                datipass.Close()<br />
<br />
                Dim x As String<br />
                Dim y As Decimal<br />
                Dim total As Decimal<br />
                Dim i As Integer<br />
<br />
                For i = 0 To ipassinfo.Count - 1<br />
                    x = ipassinfo.GetKey(i)<br />
<br />
                    y = DirectCast(ipassinfo.GetByIndex(i), user).domestictotal  <-------------- here is where i am having the trouble<br />
                    total = y + total<br />
<br />
                    tb_usertotals.AppendText(x.PadRight(20) & ControlChars.Tab & y.ToString("C") & vbNewLine)<br />
                    Me.tb_usersmade.Text = i<br />
                Next i<br />
                Me.Tb_totals.Text = total.ToString("c")<br />
             <br />
            End If<br />
        End With<br />
    End Sub<br />


-- modified at 16:36 Thursday 4th May, 2006
QuestionRetriving Field schema using ADO Pin
Quecumber2564-May-06 9:44
Quecumber2564-May-06 9:44 
QuestionFile replace and backup Pin
erniebert4-May-06 7:16
erniebert4-May-06 7:16 
QuestionReport Problem...Please help Pin
airprince4-May-06 6:54
airprince4-May-06 6:54 
AnswerRe: Report Problem...Please help Pin
Mekong River4-May-06 15:51
Mekong River4-May-06 15:51 
QuestionPlease Help Me.... Pin
airprince4-May-06 6:42
airprince4-May-06 6:42 
AnswerRe: Please Help Me.... Pin
Guffa4-May-06 8:09
Guffa4-May-06 8:09 
QuestionDatagrid: how to detect uncommitted changes? Pin
Roger Harvest4-May-06 6:39
Roger Harvest4-May-06 6:39 
QuestionPInvoke stack balance detected? Pin
Rashar4-May-06 6:25
Rashar4-May-06 6:25 
AnswerRe: PInvoke stack balance detected? Pin
kasik4-May-06 7:23
kasik4-May-06 7:23 
QuestionVB.Net Arrays Pin
passionirie4-May-06 5:22
passionirie4-May-06 5:22 
AnswerRe: VB.Net Arrays Pin
J4amieC4-May-06 5:40
J4amieC4-May-06 5:40 
QuestionCOMBOBOX Pin
moveman4-May-06 5:20
moveman4-May-06 5:20 
AnswerRe: COMBOBOX Pin
Quecumber2564-May-06 6:01
Quecumber2564-May-06 6:01 
AnswerRe: COMBOBOX Pin
Quecumber2564-May-06 6:28
Quecumber2564-May-06 6:28 
QuestionFREE .NET Related Material Pin
dotnetguide4-May-06 5:03
dotnetguide4-May-06 5:03 
AnswerRe: FREE .NET Related Material Pin
J4amieC4-May-06 5:39
J4amieC4-May-06 5:39 
Questiontextbox Pin
bawades4-May-06 4:17
bawades4-May-06 4:17 

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.