473,399 Members | 3,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

11th hour failure to trigger click event for object in hash table

Someone else had a question on how to emulate a mouse click. I tried posting
in that thread but I have something of a twist on this problem and I'm
really in trouble here! If I don't get help soon, I'm going to fail this
class and the class is already dragging down my GPA. I'm taking an
introductory visual basic class with an advanced visual basic book and
assignments (the department dropped the prerequisite and the class needs one.
I've taken some programming but this isn't programming and you can't find
the code that you need because half the time the answer isn't even in the
code!)

If this is a dumb question, that's because I'm a student in a 200 level
Visual Basic class. I did try the local help, and search for similar
problems, and look in the book, and ask my school's help desk (none of them
know Visual Basic and the tutoring center is closed)

I'm supposed to make a gomokuo game, including a
computer strategy, as well as a computer random player.

The game board consists of 36 picture boxes. I added them all to a hash table
(BTW, don't know if it matters but the way the keys are set up, the row is
in the tens and the column is in the ones)

I just finished the logic for the computer strategy. I thought the random
player part would be easy.

At the last minute, I tested it and realized that the code that I had to
trigger the
click event subroutine did not work.

The problem is that the sender is supposed to be a member of a hash table. I
need to trigger a sub called "gpic_click," which is the event handler for
the click events of the 36 picture boxes. I need to trigger it with the
correct
picture box (i.e. hashboard(key)) as the sender.

So I need to trigger the click event itself.

I was using hashboard(key).click but that didn't work.

I even tried making a case selection structure

"Select case key
case 11
gpic11.click"
etc.

and that won't even work because the subroutine isn't called gpic11_click
or gpicc25_click, it's one subroutine that handles a lot of click events, and
the instructions were to call the click event handler subroutine for that
particular object and I need to be able to do this without a case selection
structure and 36 copies of the click subroutine.

I just tried duplicating the subroutine and it won't even let me do that!
I can't call a subroutine in the SAME CLASS! It wants an argument and I
have no idea what to put there and it won't tell me and the information is
totally unavaialable and I can't get anyone to help me because everyone's too
good for Visual Basic.

I have a little more than three hours until my academic career, which is the
single most important thing in my life, goes down the toilet because of this!
PLEASE HELP!

TIA
Dec 11 '06 #1
4 1821
LyzH <Ly**@discussions.microsoft.comwrote:
>It wants an argument and I
have no idea what to put there and it won't tell me and the information is
totally unavaialable
At this point we have even less information than you about what that
function is and what argument it expects. At least give us a hint!

--
Lucian
Dec 11 '06 #2
Quite an explanation. Hope there is still some time left... realize "you're
doing it wrong" :-) but this will work.

A click event handler is a function like any other so you can call it
directly. The problem only occurs if you intend to reference the parameters
since a "click event" never happened so clearly what got clicked needs to be
supplied by you.

If your control handler is named gpic_click() it is expecting (I imagine) a
"sender" (System.Object) and an "e" (System.EventArgs). So to simulate a
click on gpic11 you call gpic_click( gpic11, New System.EventArgs)

Good luck.

Tom
"LyzH" <Ly**@discussions.microsoft.comwrote in message
news:4E**********************************@microsof t.com...
Someone else had a question on how to emulate a mouse click. I tried
posting
in that thread but I have something of a twist on this problem and I'm
really in trouble here! If I don't get help soon, I'm going to fail this
class and the class is already dragging down my GPA. I'm taking an
introductory visual basic class with an advanced visual basic book and
assignments (the department dropped the prerequisite and the class needs
one.
I've taken some programming but this isn't programming and you can't find
the code that you need because half the time the answer isn't even in the
code!)

If this is a dumb question, that's because I'm a student in a 200 level
Visual Basic class. I did try the local help, and search for similar
problems, and look in the book, and ask my school's help desk (none of
them
know Visual Basic and the tutoring center is closed)

I'm supposed to make a gomokuo game, including a
computer strategy, as well as a computer random player.

The game board consists of 36 picture boxes. I added them all to a hash
table
(BTW, don't know if it matters but the way the keys are set up, the row
is
in the tens and the column is in the ones)

I just finished the logic for the computer strategy. I thought the
random
player part would be easy.

At the last minute, I tested it and realized that the code that I had to
trigger the
click event subroutine did not work.

The problem is that the sender is supposed to be a member of a hash table.
I
need to trigger a sub called "gpic_click," which is the event handler for
the click events of the 36 picture boxes. I need to trigger it with the
correct
picture box (i.e. hashboard(key)) as the sender.

So I need to trigger the click event itself.

I was using hashboard(key).click but that didn't work.

I even tried making a case selection structure

"Select case key
case 11
gpic11.click"
etc.

and that won't even work because the subroutine isn't called gpic11_click
or gpicc25_click, it's one subroutine that handles a lot of click events,
and
the instructions were to call the click event handler subroutine for that
particular object and I need to be able to do this without a case
selection
structure and 36 copies of the click subroutine.

I just tried duplicating the subroutine and it won't even let me do that!
I can't call a subroutine in the SAME CLASS! It wants an argument and I
have no idea what to put there and it won't tell me and the information is
totally unavaialable and I can't get anyone to help me because everyone's
too
good for Visual Basic.

I have a little more than three hours until my academic career, which is
the
single most important thing in my life, goes down the toilet because of
this!
PLEASE HELP!

TIA

Dec 12 '06 #3
Thanks for getting back to me. Sorry I'm a little panicked.

At this point, I created a different subroutine to do all of the things that
the click routine does. The computer gets its very own subroutine because it
refuses to click.

What the functions are is:
When someone clicks on one of 36 picture boxes (enumerated in the "handles"
clause of the heading of the subroutine)

Change the tag property of the sender. (the tag holds a 0 for empty square,
1 for square controlled by player 1, or 2 for square controlled by player 2)

Change the image displayed by the sender.

In the case of the computermove subroutine that I wrote, the square
corresponding to the key value passed "hashboard(key)" takes the place of
sender. I know that a reference to that works because I use a "for each" to
reset the images when user presses the "new game" button.

--------------------

However, I can't pass anything from the business tier or to the business
tier and it wants me to create a new instance of the business tier every time
I refer to it.

The business tier can access friend declared variables from the presentation
tier (the game board or the opening screen) but a public property of the
business tier is "a non-shared member," as are public variables and subs of
the business tier.

I don't know why but "public" and "friend" don't appear to mean the same
things when I try to use them.

It tells me I need an object reference. I look up object reference and
non-shared member, and the help tells me that, if I have a non-shared member,
I need an object reference. That is so typical of Microsoft's "help."

My book explains nothing. The index contains neither term.

I have 21 minutes. The help desk is saying the lab will be open tomorrow but
there are notices posted _everywhere_ saying that it will not be.

Again, thanks
Lyz
"Lucian Wischik" wrote:
LyzH <Ly**@discussions.microsoft.comwrote:
It wants an argument and I
have no idea what to put there and it won't tell me and the information is
totally unavaialable

At this point we have even less information than you about what that
function is and what argument it expects. At least give us a hint!

--
Lucian
Dec 12 '06 #4
Thanks; that is what I wanted to know.

Now my only problem is to deal with the fact that I have a seperate class
for the
computer strategy and it hangs at the point where it is supposed to call a
public function from that class.

It doesn't throw an exception or anything, it just stops.

Gotta go. Lab closing. Will be open tomorrow, I hope.

Thanks.
"Tom Leylan" wrote:
Quite an explanation. Hope there is still some time left... realize "you're
doing it wrong" :-) but this will work.

A click event handler is a function like any other so you can call it
directly. The problem only occurs if you intend to reference the parameters
since a "click event" never happened so clearly what got clicked needs to be
supplied by you.

If your control handler is named gpic_click() it is expecting (I imagine) a
"sender" (System.Object) and an "e" (System.EventArgs). So to simulate a
click on gpic11 you call gpic_click( gpic11, New System.EventArgs)

Good luck.

Tom
"LyzH" <Ly**@discussions.microsoft.comwrote in message
news:4E**********************************@microsof t.com...
Someone else had a question on how to emulate a mouse click. I tried
posting
in that thread but I have something of a twist on this problem and I'm
really in trouble here! If I don't get help soon, I'm going to fail this
class and the class is already dragging down my GPA. I'm taking an
introductory visual basic class with an advanced visual basic book and
assignments (the department dropped the prerequisite and the class needs
one.
I've taken some programming but this isn't programming and you can't find
the code that you need because half the time the answer isn't even in the
code!)

If this is a dumb question, that's because I'm a student in a 200 level
Visual Basic class. I did try the local help, and search for similar
problems, and look in the book, and ask my school's help desk (none of
them
know Visual Basic and the tutoring center is closed)

I'm supposed to make a gomokuo game, including a
computer strategy, as well as a computer random player.

The game board consists of 36 picture boxes. I added them all to a hash
table
(BTW, don't know if it matters but the way the keys are set up, the row
is
in the tens and the column is in the ones)

I just finished the logic for the computer strategy. I thought the
random
player part would be easy.

At the last minute, I tested it and realized that the code that I had to
trigger the
click event subroutine did not work.

The problem is that the sender is supposed to be a member of a hash table.
I
need to trigger a sub called "gpic_click," which is the event handler for
the click events of the 36 picture boxes. I need to trigger it with the
correct
picture box (i.e. hashboard(key)) as the sender.

So I need to trigger the click event itself.

I was using hashboard(key).click but that didn't work.

I even tried making a case selection structure

"Select case key
case 11
gpic11.click"
etc.

and that won't even work because the subroutine isn't called gpic11_click
or gpicc25_click, it's one subroutine that handles a lot of click events,
and
the instructions were to call the click event handler subroutine for that
particular object and I need to be able to do this without a case
selection
structure and 36 copies of the click subroutine.

I just tried duplicating the subroutine and it won't even let me do that!
I can't call a subroutine in the SAME CLASS! It wants an argument and I
have no idea what to put there and it won't tell me and the information is
totally unavaialable and I can't get anyone to help me because everyone's
too
good for Visual Basic.

I have a little more than three hours until my academic career, which is
the
single most important thing in my life, goes down the toilet because of
this!
PLEASE HELP!

TIA


Dec 12 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: nosbtr1 | last post by:
When a row gets modified and it invokes a trigger, we would like to be able to update the row that was modified inside the trigger. This is (basically) how we are doing it now: CREATE TRIGGER...
2
by: kj | last post by:
How does one trigger an event programmatically? I'm interested in how to do this in both the "Level 0" event model as well as in the DOM Level 2 event model. Thanks! kj -- NOTE: In my...
9
by: VK | last post by:
My original idea of two trains, however pictural it was, appeared to be wrong. The truth seems to be even more chaotic. IE implements its standard down-up model: any mouse event goes from the...
1
by: Mike | last post by:
I have a form that I am using Condiftional formatting to create a dashboard to indicate if there are records for each weekday of the selected week. I have inserted requery commands on AfterUpdate...
0
by: OceanBreeze | last post by:
I have added a LinkButton to a table cell programmatically inside the Page_Load method. I also added a custom event to that link button. The same custom event is valid for all the link buttons. The...
3
by: Terry | last post by:
Hi, I have a button ("button1") embedded into another control ("LoginView1"). In the code-behind environment of VWD (visual web dev.), i cant' use the event button1_onclick because 'button1'...
0
by: wugon.net | last post by:
Hi , Anyone know how to monitor db2 trigger activity ? We suffer some trigger issue today and we try to monitor trigger's behavior use event monitor and db2audit, but both tools can not get...
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.