Daniel Martos

Ranch Hand
+ Follow
since Oct 01, 2016
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Daniel Martos

I tried to create a collection, as suggested.  I received an error stating that Unable to cast object of type 'System.Int32' to type 'System.Windows.Forms.Control'


7 years ago

Campbell Ritchie wrote:Can you make the selected items in each of the boxes into a collection and do anything like this on it? That will avoid your having to iterate the box 5×.

Duplicating discussion in our VB forum.



I'm not real sure how to to that.  Here's the entire code:

7 years ago
I have 2 ListBoxes.  ListBox1 is populated with 5 selected numbers from a CheckedListBox(LotteryBox) and ListBox2 is populated with random numbers 1-99.  I want to find a way to verify if the numbers in the two ListBoxes match.  For Example, if they matched one number.  It'll say "You've matched one number".  and so on.  I think I'm on the right path with:



But how do I differentiate between the five numbers selected in the LotteryBox?
7 years ago
I tried it with a switch statement and it works to tell you if it you choose the incorrect section, but if you choose the right section it skips the rest of the validation (because it's returning true), doesn't print the confirmation message, and advances straight to the form processor page.  Any idea of how I can do this without returning true?  

I'm sorry, that bit of code is:

Bear Bibeault wrote:Exactly how is it not working? What's happening differently than your expectations?

Have you learned how to set breakpoints to help with debugging?



This bit of code doesn't display the "You must select a valid section for CIS 100!" message, if the person selects an incorrect section.  It also bypasses the confirmation message and goes straight to the form processor on the next page.  I do not know about breakpoints.

Jeanne Boyarsky wrote:Daniel,
Do you have a question about that code or just sharing? Is there something in particular that doesn't work?



Yes, I'm sorry.  The bit of code at the top isn't working and I'm looking for advice about why.
I created a course registration page that allows you to choose a course and then a section.  Right now, you can choose a course and a section that doesn't fit the course.
I want to create validation code that ensures that my course section is valid for for my course.  Here's what I'm trying:



And here is my entire code:



My question is twofold. First, I can't seem to figure out how to get my confirm message box's ok and cancel to work correctly. The assignment calls for me to run the message, then validate my info, and if it validates, alert for ok or cancel. I have done it the other way around (validate....message....alert), but I'm not sure how to do this.

Second, my reset button clears my info whether I hit ok or cancel??? Any ideas?


I'm trying to figure out how to calculate tuition using two arrays.  This is incomplete code.  I just want someone to look at my function to even tell me if I'm close with this thing.

NaN

Bear Bibeault wrote:In order to use getElementById, the element must have an id. The name is not the same as an id. (name is only used for form submission, so you don't really even need one here.)

There is also getElementsByName if you want to continue to use names.





Yes, I remember that now, but nothing is happening when I hit the button.
NaN

Bear Bibeault wrote:No, those variables are undefined in the onchange handler.

It seems you are just guessing at this point; you need to ask yourself what values you want to actually pass into the function. When onchange triggers, what is it you actually want to have happen?



Trying getElementByID.....still nothing...ugh

NaN

Bear Bibeault wrote:No, those variables are undefined in the onchange handler.

It seems you are just guessing at this point; you need to ask yourself what values you want to actually pass into the function. When onchange triggers, what is it you actually want to have happen?



Not guessing just trying to problem solve.  I did some more research and made just changes, but am still at an I'm at an impasse.

NaN
Still the same issue....

NaN

Bear Bibeault wrote:In the following code, where do you pass two numbers?

You pass nothing.

What is it you want to be multiplying together? Those values need to be passed to the function.



Oh, I didn't realize you meant down there.  So if I put the variables in the onchange, I will be alright?