• Lucid Dreaming - Dream Views




    Results 1 to 11 of 11
    1. #1
      Member Achievements:
      1 year registered Created Dream Journal Tagger Second Class Veteran First Class 5000 Hall Points
      Tavasion's Avatar
      Join Date
      Jun 2006
      LD Count
      a vivid few
      Gender
      Location
      Earth
      Posts
      283
      Likes
      67
      DJ Entries
      3

      Need help with Visual Basic, NOW!!!

      ive attached the example of the program.

      i cant get William & Keeper to show up. i select it, then hit caluclate, and it wont show up. Debug says it cant find the file, although i have it in the Debug folder. everything wlse works fine, just William and Keeper. here is the code. and i have to submit this by 12 tonight. it is now....7:47 pm.

      Code:
      Private Sub btncalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncalc.Click
      
              Dim file, customer, status As String
              Dim sr As IO.StreamReader
      
              If (cboCustomer.Text = "William & Keeper") Then
                  file = "org1.txt"
              ElseIf (cboCustomer.Text = "Joshemine Company") Then
                  file = "org2.txt"
              ElseIf (cboCustomer.Text = "McColling Foundation") Then
                  file = "org3.txt"
              Else
                  file = "org1.txt"
                  MsgBox("No customer selected. Option A will be used.", MsgBoxStyle.Exclamation, "Caution")
              End If
      
      
              sr = IO.File.OpenText(file)
              customer = sr.ReadLine
              status = sr.ReadLine
              sr.Close()
      
              Dim hours As Double
              hours = CDbl(txtHours.Text)
      
              Dim total, base, overage As Double
      
      
              If rad1.Checked Then
                  base = (9.95)
                  overage = ((hours - 10) * 2)
                  total = base + overage
              ElseIf rad2.Checked Then
                  base = (14.95)
                  overage = (hours - 20)
                  total = base + overage
              ElseIf rad3.Checked Then
                  base = (19.95)
                  total = base
              End If
      
      
              If (cboCustomer.Text = "McColling Foundation") Then
                  total = total - (total * 0.2)
              End If
      
      
              Dim fmtStr As String = "{0,-20}{1,7}{2,7}{3,12}"
              lstDisplay.Items.Add(String.Format(fmtStr, "Name", "Hours", "Status", "Bill"))
      
      
              If (cboCustomer.Text = "William & Keeper") Then
                  lstDisplay.Items.Add(String.Format(fmtStr, "William & Keeper", hours, status, FormatCurrency(total)))
              ElseIf (cboCustomer.Text = "Joshemine Company") Then
                  lstDisplay.Items.Add(String.Format(fmtStr, "Joshemine Company", hours, status, FormatCurrency(total)))
              ElseIf (cboCustomer.Text = "McColling Foundation") Then
                  lstDisplay.Items.Add(String.Format(fmtStr, "McColling Foundation", hours, status, FormatCurrency(total)))
              End If
      
      
      
          End Sub
      
      End Class
      Attached Files
      Last edited by Tavasion; 09-30-2009 at 01:47 AM.


      The evening hangs beneath the moon, a silver thread on darkened dune.
      With closing eyes and resting head; I know that sleep is coming soon.

      Upon my pillow, safe in bed,
      A thousand pictures fill my head,

      I cannot sleep , my mids aflight;
      and yet my limbs seems made of lead.
      ---Whitacre's Sleep---

    2. #2
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Mind posting it again usign the [code][/code] tags so that we can see the indentation.

    3. #3
      Member Achievements:
      1 year registered Created Dream Journal Tagger Second Class Veteran First Class 5000 Hall Points
      Tavasion's Avatar
      Join Date
      Jun 2006
      LD Count
      a vivid few
      Gender
      Location
      Earth
      Posts
      283
      Likes
      67
      DJ Entries
      3
      done.
      Last edited by Tavasion; 09-30-2009 at 01:53 AM.


      The evening hangs beneath the moon, a silver thread on darkened dune.
      With closing eyes and resting head; I know that sleep is coming soon.

      Upon my pillow, safe in bed,
      A thousand pictures fill my head,

      I cannot sleep , my mids aflight;
      and yet my limbs seems made of lead.
      ---Whitacre's Sleep---

    4. #4
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Been a very long time since I did any form of basic but I'm missing something. Where is cboCustomer defined?

    5. #5
      Member Achievements:
      1 year registered Created Dream Journal Tagger Second Class Veteran First Class 5000 Hall Points
      Tavasion's Avatar
      Join Date
      Jun 2006
      LD Count
      a vivid few
      Gender
      Location
      Earth
      Posts
      283
      Likes
      67
      DJ Entries
      3
      i dont think it needs to be.
      Last edited by Tavasion; 09-30-2009 at 02:25 AM.


      The evening hangs beneath the moon, a silver thread on darkened dune.
      With closing eyes and resting head; I know that sleep is coming soon.

      Upon my pillow, safe in bed,
      A thousand pictures fill my head,

      I cannot sleep , my mids aflight;
      and yet my limbs seems made of lead.
      ---Whitacre's Sleep---

    6. #6
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      It has to be defined somewhere.

    7. #7
      Banned
      Join Date
      May 2007
      LD Count
      Loads
      Gender
      Location
      Digital Forest.
      Posts
      6,864
      Likes
      386
      He's using dotnet, it looks like. That would just be an object defined... Automatically I guess

      It's a control.

    8. #8
      Member Achievements:
      1 year registered Created Dream Journal Tagger Second Class Veteran First Class 5000 Hall Points
      Tavasion's Avatar
      Join Date
      Jun 2006
      LD Count
      a vivid few
      Gender
      Location
      Earth
      Posts
      283
      Likes
      67
      DJ Entries
      3
      and the other companies work fine in the program. its just the William and Keeper one that doesnt work.


      The evening hangs beneath the moon, a silver thread on darkened dune.
      With closing eyes and resting head; I know that sleep is coming soon.

      Upon my pillow, safe in bed,
      A thousand pictures fill my head,

      I cannot sleep , my mids aflight;
      and yet my limbs seems made of lead.
      ---Whitacre's Sleep---

    9. #9
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      I'm betting it's that ampersand, that's why I'm wondering what type of object cboCustomer is. My guess is that whatever you're expecting it to be is Unicode encoded or escaped.

      Try doing a MsgBox(cboCustomer.Text) What's the debugger say that it is, go through it line by line and if it's still messing up, Valgrind it.
      Last edited by ninja9578; 09-30-2009 at 03:02 AM.

    10. #10
      FBI agent Ynot's Avatar
      Join Date
      Oct 2005
      Gender
      Location
      Southend, Essex
      Posts
      4,337
      Likes
      14
      Why are you comparing the text of a drop-down box?
      that's not how they're designed to operate

      Assign a numerical value to each entry and test that.
      The text is designed to be, and should be treated as, completely arbitrary

      Also, lol @ valgrind on a windows box to debug a VB app
      that's a little out of their league, me thinks
      (\_ _/)
      (='.'=)
      (")_(")

    11. #11
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Oh, that's a choice control? Yeah, use an enumerated type which refers to GetValue(). Doing text comparisons are very very slow.

      Secondly, you should never ever use a member of a predefined class like that. You should use the Setters and Getters, that might be why you're having trouble. It might be held in .Text in some strange format that's reformatted in the getter.
      Last edited by ninja9578; 09-30-2009 at 03:26 AM.

    Bookmarks

    Posting Permissions

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