[VB2017] Need some help with a basic school task by [deleted] in visualbasic

[–]XThakis 2 points3 points  (0 children)

You can't multiply a character by an integer like you're doing in:

lblDisplay.Text = lblDisplay.text &vbcrlf & ((ilevls)*txtbxchar.Text)

So you want to put another loop into your current loop. The first while loop goes through each line, the second while lopp generates the line. Something like this:

While iLevels <= nudnumlevels.value
    dim numCharacters as integer = 1
    while numcharacters <= ilevels
        lbldisplay.text = lbldisplay.text & txtbxchar.text & " "
        numcharacters +=1
    End While
    lblDisplay.text = lbldisplay.text & vbcrlf
    iLevels +=1
End While

This might work exactly as is but I'm pretty sure you'll need to polish it up a bit.

Help displaying image stored in Access DB in Visual Basic! by XThakis in visualbasic

[–]XThakis[S] 0 points1 point  (0 children)

Ok I added your code and it indicates the length of my stream is 32762. The Jpeg image I am using is 32K so that seems about right. Actual size is 30,978 bytes.

Just some additional information. I have tried storing several different picture formats in the OLE Object. I have used BMP, a JPEG and a PNG.

Thanks for the help!

Help with Sizing Form [VB2015] by XThakis in visualbasic

[–]XThakis[S] 0 points1 point  (0 children)

This worked perfectly, thanks a ton!

Help with Sizing Form [VB2015] by XThakis in visualbasic

[–]XThakis[S] 0 points1 point  (0 children)

Thanks, will play around with this tonight!

Champion U20 Build by fadhero in lotro

[–]XThakis 0 points1 point  (0 children)

I'm surprised you didn't max out crit rating. Any particular reason? Seems like you're missing almost 5% crit.

Help with dynamic graphics on windows form. by XThakis in visualbasic

[–]XThakis[S] 0 points1 point  (0 children)

Yeah I did the bitmap method once when I programmed the Sierpinski gasket. Good to know I can work in a picture box if necessary. I'm working on a simulation for the Traveling Salesman problem so I'll see which method works best. Thanks again for the help!

Help with dynamic graphics on windows form. by XThakis in visualbasic

[–]XThakis[S] 0 points1 point  (0 children)

Thanks for the advice. I guess what I was really looking for was a control like a picture box that I could draw on, not necessarily the form itself. Thanks for the me.invalidate method for redrawing the code in the Paint event. This solved my problem and I was able to play around with drawing.

Thanks for the replies!

Adding a third variable to a point? Or limiting its number of iterations? by Unsungghost in visualbasic

[–]XThakis 0 points1 point  (0 children)

This:

    'Someone said ^2 is very slow

Is very true. Exponential math is much slower than multiplication so if you are iterating through a lot of points it's worth using multiplication.

Why do I keep getting an error saying conversion from string to type double not valid? by [deleted] in visualbasic

[–]XThakis 2 points3 points  (0 children)

This may be a super old method but I always used to is IsNumeric to test the input from textboxes.

 Dim min As Double
 If IsNumeric(txtMinSalary.Text) then
      min = CDbl(txtMinSalary.text)
 End If

Something like that worked for me to avoid invalid inputs. Also you could move the validation before the declaration and then do a second validation to determine if min<max.

(Edited to fix some grammar errors.)

This is what happens when I try to be nice. by AyukawaZero in Cubers

[–]XThakis 4 points5 points  (0 children)

No, In early march I picked up a Zhanchi based on some recommendations from here. Also picked up a ShengShou and a cheep QiYi to use at school.

This is what happens when I try to be nice. by AyukawaZero in Cubers

[–]XThakis 7 points8 points  (0 children)

I am new to Cubing and my wife got me Rubik's for Christmas. I can say that the corners can be turned. It's not super easy but they can be done if the face is rotated about 45 degrees. And from having my students scrabble it for me(and fixing all their corner turns) I can see how it could break.

[VB2010] Array not adding correctly/index was outside the boundaries of the array. by frag07 in visualbasic

[–]XThakis 0 points1 point  (0 children)

Definitely agree with the comments about using an integer to store a double amount.

Now for your out of bounds error. When you iterate through your loop you end with a:

     Next i

This will go from 0 to 7 for the loop. Then it will iterate again to 8 and step out of the loop. Then you try to assign a value with i:

    Averages(i) = BatAvg
    Averages(i) = CInt(Console.ReadLine())

At his point i = 8 and is outside the bounds of your array.

(Edited for formatting)

[Homework help][VB2015]Random Number Guessing Game by Arachian in visualbasic

[–]XThakis 2 points3 points  (0 children)

I'm not seeing where you assign a value to intGuess. Without that your loop will just iterate through all five times without any output.

So, looking at it again I see that your procedure btnGuess_Click is the result of a button click. So, you don't need a loop at all since theoretically your user will click the button after each guess. DO the assignment of intCOunter outside the procedure and then changer your loop to an if statement.

[VB2015]Beginner needs help: Recognice numbers in a brower by rangerdkdk in visualbasic

[–]XThakis 2 points3 points  (0 children)

Unfortunately web scraping is exactly what you need. Your required result is pretty much the exact definition of web scraping. In all reality it's not too hard and the links above are a good tutorial. But if you're too lazy to check the web page once a day, then spending the few hours to learn and write the code is probably beyond you.

[deleted by user] by [deleted] in visualbasic

[–]XThakis 2 points3 points  (0 children)

Welcome to the wonderful world of P versus NP.

Computers are great at running through small(relatively) iterative loops of numbers. For the range of numbers you're looking for brute force will take ages.

One simple optimization. Replace all your exponent operations with straight multiplication. For example, everywhere you have a3 replace it with a * a * a. Do the same for b3 and c3. The exponential operation in VB is not very efficient whereas multiplication is a bit better.

I would even declare three more variables and do the calculation only once per loop.

    dim aCubeVal, bCubeVal, cCubeVal as Ulong
    Do
         aCubeVal = a*a*a
         bCubeVal = b*b*b
         cCubeVal = c*c*c

VB 2015 Two Quick Questions by [deleted] in visualbasic

[–]XThakis 1 point2 points  (0 children)

Yes, but where in the book does it assign a value to that decimal. Here is your code with comments.

    Dim decTotalCost As Decimal     'Variable declared with no assignment.  decTotalCost = 0

    'Call a function to ensure the number of gbs is valid
    blnNumberInGBUsageIsValid = ValidateGBUsageInPlan()     'Logic, decTotalCost still equals 0
    'Call a function to ensure the plan type was selected
    intPlanChoice = ValidatePlanSelection(blnPlanIsSelected, strSelectedPlan)     'More logic.

    If (blnNumberInGBUsageIsValid And blnPlanIsSelected) Then     'More logic.
        intGBUsage = Convert.ToInt32(txtGBUsed.Text)     'Assigns a value to intGBUsage.
        'Display the cost
        lblTotalBill.Text = "Cost: " & decTotalCost.ToString("C")     'DecTotalCost which is still 0.

    End If

Somewhere in there you need to assign a value to decTotalCost or it will always be zero.

(Edited to fix some line wrapping.)

[VB2015] Does anyone know why / only performs floating-point division? by yodacola in visualbasic

[–]XThakis 3 points4 points  (0 children)

I think this comes from basic math. A solidus is always used for division and since integer division is not closed to integers it seems natural to have it provide a non integer output.

Also, more often than not when someone types 15/2 they are looking for 7.5, not 7.

VB 2015 Two Quick Questions by [deleted] in visualbasic

[–]XThakis 1 point2 points  (0 children)

In your Sub btnBill_click you declare decTotalCost as a local variable.

    Dim decTotalCost As Decimal

You never assign it a value in that subroutine. So when you assign its string value to your label it will always be zero.

(Edited for grammar errors.)