Hi everyone,
I've been using VB.NET for about 6 weeks now and I keep stumbling on a
concept that I hope someone can clear up for me. Each event of a
control has 2 parameters, sender and e....I am not understanding what
the purpose of those parameters are. Can someone clear that up?
Along those lines, I also don't understand how to make a call to a
Click event...what are you supposed to pass in?
In a program that I am working on I need to draw a border around a
panel. I did some research and found some code that will do just that
(sorry if it pastes ugly):
Private Sub PaintBorder(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs)
ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle,
Color.Black, 3, ButtonBorderStyle.Solid, Color.Black, 3,
ButtonBorderStyle.Solid, Color.Black, 3, ButtonBorderStyle.Solid,
Color.Black, 3, ButtonBorderStyle.Solid)
End Sub
How would I call this function if I wanted to paint a border on a panel
called Panel1???
Thank you in advance for any help! 2 9812
The S is the source object (Form, control, class, etc.) that fired the event.
If you want to fire the click event for a control, use
myControl.PerformClick.
In the Click event, you can access the source object's properties, methods,
etc. by:
DirectCast ( S, myControlThatFiredEventType).myControlThatFiredEve ntProperty1.
For example if a Button click event is fired from a form, you can set the
form''s backcolor in the click event as follows:
DirectCast(S, Form).BAckColor = Color.Red
Hope this helps.
--
Dennis in Houston
"GatorBait" wrote: Hi everyone,
I've been using VB.NET for about 6 weeks now and I keep stumbling on a concept that I hope someone can clear up for me. Each event of a control has 2 parameters, sender and e....I am not understanding what the purpose of those parameters are. Can someone clear that up?
Along those lines, I also don't understand how to make a call to a Click event...what are you supposed to pass in?
In a program that I am working on I need to draw a border around a panel. I did some research and found some code that will do just that (sorry if it pastes ugly):
Private Sub PaintBorder(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, Color.Black, 3, ButtonBorderStyle.Solid, Color.Black, 3, ButtonBorderStyle.Solid, Color.Black, 3, ButtonBorderStyle.Solid, Color.Black, 3, ButtonBorderStyle.Solid) End Sub
How would I call this function if I wanted to paint a border on a panel called Panel1???
Thank you in advance for any help!
One more answer to your last question:
Try Panel1.Invalidate..this will trigger the Paint Event.
--
Dennis in Houston
"GatorBait" wrote: Hi everyone,
I've been using VB.NET for about 6 weeks now and I keep stumbling on a concept that I hope someone can clear up for me. Each event of a control has 2 parameters, sender and e....I am not understanding what the purpose of those parameters are. Can someone clear that up?
Along those lines, I also don't understand how to make a call to a Click event...what are you supposed to pass in?
In a program that I am working on I need to draw a border around a panel. I did some research and found some code that will do just that (sorry if it pastes ugly):
Private Sub PaintBorder(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, Color.Black, 3, ButtonBorderStyle.Solid, Color.Black, 3, ButtonBorderStyle.Solid, Color.Black, 3, ButtonBorderStyle.Solid, Color.Black, 3, ButtonBorderStyle.Solid) End Sub
How would I call this function if I wanted to paint a border on a panel called Panel1???
Thank you in advance for any help!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Johnny |
last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form
(fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip
code. The user can enter a zip code in the text box and...
|
by: Johnny |
last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form
(fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip
code. The user can enter a zip code in the text box and...
|
by: Anne |
last post by:
hie there, i want to be able to pass multiple parameters
to another page. currently, i am able to do so, but
somehow i feel it is not the correct way to do it. below
is part of what i have so far....
|
by: Paul Allan |
last post by:
I am new to ASP.net (intermediate ASP developer). I am developing a ASP.net
web application and I am having some difficulty calling and passing
parameters to a function that is declared in my...
|
by: Jim via DotNetMonster.com |
last post by:
Hi,
I need to pass the value of a variable from one function to another but I
don't seem to get the value. I declare the variable outside all functions.
What I'm trying to do is that when the...
|
by: NicK chlam via DotNetMonster.com |
last post by:
this is the error i get
System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
at System.Data.Common.DbDataAdapter.Update(DataRow dataRows,
DataTableMapping tableMapping)
at...
|
by: Richard Grant |
last post by:
Hi. In c/C++ i can pass the address of a subroutine to another subroutine as an actual parameter
How do I do that in VB .NET
What should be the syntax for a parameter to receive the address of a...
|
by: Robert |
last post by:
I am creating a small help browser. It is pretty much finished except I
cannot find how to pass a file to it (i.e. browser.exe index.html, or any
html file, and the html file opens in the browser)...
|
by: jcrouse |
last post by:
I have an app with form1 and form2. Form1 has a label control. Form2 has a checkbox and OK button. By default the label on form1 is hidden. When I lauch my app form1 is the default. I right click on...
|
by: jtammyg |
last post by:
Hi!
I have the following snippet that gives the name of the sql servers
installed:
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |