1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Help with using two inputs to one output

Discussion in 'C' started by petrina1, Jan 29, 2011.

  1. petrina1

    petrina1 New Member

    Hello all I need some help badly ; i have been at this hours with no luck in solving my problem

    I am doing a project in which i have two different costs of cookies (1 dollar for regular )and (1.50 for large). I am trying to get the user to be able to enter the amount of each cookie and it goes to one output(a label). I tried using the two codes below but they interfere with each other; only one works at a time. (either reg or large) curious how to get both working where i enter the amounts? PLEASE HELP
    Dim input As Decimal
    input = Decimal.Parse(LargeCookieQtyTextbox.Text)
    input = input * 1.5D
    CookiesCostLabel.Text = input.ToString(

    Dim inputinteger As Integer 
    inputinteger =
    inputinteger = inputinteger * 1I
    CookiesCostLabel.Text = inputinteger.ToString(
  2. poornaMoksha

    poornaMoksha New Member

    Not sure though, but seems like you are updating the same variable 'CookiesCostLabel.Text' independently for both type of cookies...which seems like getting overwritten with every new value assigned to it....
  3. pein87

    pein87 New Member

    Are you parsing a file to get the value of the cookie? Why not use a database to store the value in to save you time or an xml file so it can be structured better. I personally have never used visual basic with xml or a database but I'm sure it would be better to structure the data that your using as input. Also get visual basic 2010 express its free and a IDE so it will warn you of your mistakes as you make them.


    Dim input AsDecimal
    will not dimension a variable named input with the type decimal.

    Dim input As Decimal 
    This is how you correctly dimension as variable with type

    I suggest that you use just the numerical value instead of adding D(decimal) and I(int) at the end. Theres no need to add that since the variable has to fit the type its been cast as.
    shabbir likes this.
  4. seoabhisek

    seoabhisek Banned

    thanks for the information shared with us

Share This Page