demausdauth's Profile User Rating: -----

Reputation: 178 Stalwart
Group:
Expert
Active Posts:
650 (0.38 per day)
Joined:
03-February 10
Profile Views:
13,021
Last Active:
User is offline Today, 06:21 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Saturn
Dream Kudos:
50
Icon   demausdauth Getting frustrated with paydays -- nothing left :(

Posts I've Made

  1. In Topic: Sessions on an Order and Checkout.aspx lblMessage Retrieving.

    Posted 19 Sep 2014

    Based on the code you have - I don't see how you are filling/setting the Session values. Obviously, the method LoadCustomerData is suppose to do this, however the code you have provided does not call this method anywhere.
  2. In Topic: Text File is populating more than it should in the listbox.

    Posted 19 Sep 2014

    Break the process you need down:
    • Move items between the stock and sell lists
    • Save the results to files


    Now break down the main processes and write out the process in pseudo code.

    Start of Move Items
        Check to make sure that stock item list has values
        Check to make sure an item is selected in stock list
        Copy the selected stock item to the sell list
        Remove the selected stock item from the stock list    
    
    


    Now let's start looking at code

    'Move vehicle from in stock to sold
    Private Sub btnSell_Click(sender As Object, e As EventArgs) Handles btnSell.Click
    
         'Check to make sure that stock item list has values
         If Not lstStock.Items.Count > 0 Then
              MessageBox.Show("There are no items to select from.")
              Return
         End If
    
         'Check to make sure an item is selected in stock list
         If Not lstStock.SelectedItems.Count > 0 Then
              MessageBox.Show("You must select at least one item.")
              Return
         End If
    
    
         'get a copy of the selected items
         Dim selectedItems(lstStock.SelectedItems.Count - 1) As String
         lstStock.SelectedItems.CopyTo(selectedItems, 0)
    
         'Move Items from one list to the other
         For Each selectedItem In selectedItems
    
              'add the stock item to sold
              lstSold.Items.Add(selectedItem)
    
              'remove selected item from the stock list
              lstStock.Items.Remove(selectedItem)
         Next
    End Sub
    
    


    There is the code that will move the items from the Stock list to the Sold list. The drawback with this code is that each item in the list has to be unique, no duplicates allowed.

    What would the code be to update your text files?
  3. In Topic: Text File is populating more than it should in the listbox.

    Posted 18 Sep 2014

    What I was trying to have you do - is come to the conclusion that the method File.AppendText will append whatever text to the file. Your load method will always re-add the same values to AutosInStock file every time you run the application.


     Private Sub Assignment_7_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            'Check to see if the Stock file exists
            ' If the stock file does not exist - that will be the only time that it is populated. 
            If Not (IO.File.Exists("AutosInStock.txt")) Then
                'No - need to create it
                Dim swauto As IO.StreamWriter
                swauto = IO.File.CreateText("AutosInStock.txt")
    
                'Populate the stock file
                swauto.WriteLine("Ford Focus 2005")
                swauto.WriteLine("Honda Accord 1997")
                swauto.WriteLine("Mustang GT 2007")
                swauto.WriteLine("Mazda CX-5 2012")
                swauto.WriteLine("Mazda-3 2013")
                swauto.Close()
    
            End If
    
            'Now load the data from the Stock file.
            Dim swautosInStock() As String = IO.File.ReadAllLines("AutosInStock.txt")
            lstStock.Items.AddRange(swautosInStock)
           
    
            'Auto Sold is created if it doesn't exist
            If Not (IO.File.Exists("AutosSold.txt")) Then
                Dim swautoSold As IO.StreamWriter = IO.File.CreateText("AutosSold.txt")
                swautoSold.Close()
            End If
    
            'Now load data from the Sold file
            Dim autosInSold() As String = IO.File.ReadAllLines("AutosSold.txt")
            lstSold.Items.AddRange(autosInSold)
    
        End Sub
    
    


    There are issues with the Sell and Repo events - take a look at those again as well. Step through the logic.
  4. In Topic: How to solve "Error executing child request for .aspx" problem

    Posted 17 Sep 2014

    Read up on Server.Transfer vs Response.Redirect.

    a article
    another article
  5. In Topic: Text File is populating more than it should in the listbox.

    Posted 17 Sep 2014

    Look carefully at your load method - think it through. Actually, step through it and discuss what is happening at each step. What happens at each line of code? What happens if the stock file does not exist? What happens if the stock file does exist? Debugging would help at this point also. And probably wouldn't hurt to read up on what each of the File Methods do.

My Information

Member Title:
D.I.C Addict
Age:
Age Unknown
Birthday:
February 2
Gender:
Location:
Minnesota
Interests:
my family, reading, programming,
Full Name:
Aaron
Years Programming:
6
Programming Languages:
VB.NET, C#.NET, ASP.NET, SharePoint 2007 development

Contact Information

E-mail:
Private

Comments

Page 1 of 1
  1. Photo

    .nethelp Icon

    07 Apr 2012 - 14:31
    why did u put -1 on my reputation coz u know better? werent u like me before ? thanks anyways this truely shows ur good spirit and what a good mentor u are .
    bye
  2. Photo

    .nethelp Icon

    07 Apr 2012 - 14:31
    why did u put -1 on my reputation coz u know better? werent u like me before ? thanks anyways this truely shows ur good spirit and what a good mentor u are .
    bye
  3. Photo

    Guest 

    29 Jun 2010 - 13:54
    http://www.dreamincode.net/forums/topic/179550-updatepanels-placeholders-and-usercontrols/
  4. Photo

    joker_1 Icon

    13 Jun 2010 - 21:37
    Hi quick question.. What is the "e" argument??
    thanks heaps
  5. Photo

    demausdauth Icon

    11 Jun 2010 - 06:05
    lol -- not trying to break any records
  6. Photo

    CharlieMay Icon

    10 Jun 2010 - 18:31
    Just wanted to say, you keep answering questions like you do and your rep is going to sky-rocket.
Page 1 of 1