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(ByV al sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs)
ControlPaint.Dr awBorder(e.Grap hics, e.ClipRectangle ,
Color.Black, 3, ButtonBorderSty le.Solid, Color.Black, 3,
ButtonBorderSty le.Solid, Color.Black, 3, ButtonBorderSty le.Solid,
Color.Black, 3, ButtonBorderSty le.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 9826
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.Perfo rmClick.
In the Click event, you can access the source object's properties, methods,
etc. by:
DirectCast ( S, myControlThatFi redEventType).m yControlThatFir edEventProperty 1.
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(ByV al sender As Object, ByVal e As System.Windows. Forms.PaintEven tArgs) ControlPaint.Dr awBorder(e.Grap hics, e.ClipRectangle , Color.Black, 3, ButtonBorderSty le.Solid, Color.Black, 3, ButtonBorderSty le.Solid, Color.Black, 3, ButtonBorderSty le.Solid, Color.Black, 3, ButtonBorderSty le.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.Invalida te..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(ByV al sender As Object, ByVal e As System.Windows. Forms.PaintEven tArgs) ControlPaint.Dr awBorder(e.Grap hics, e.ClipRectangle , Color.Black, 3, ButtonBorderSty le.Solid, Color.Black, 3, ButtonBorderSty le.Solid, Color.Black, 3, ButtonBorderSty le.Solid, Color.Black, 3, ButtonBorderSty le.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 click a button to
determine whether the zip code is unique. If the zip code is not unique,
another form/dialog is displayed (fclsLookup) - lookup form/dialog. The zip
code and zipid are both passed to the lookup form/dialog by reference. I...
|
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 click a button to
determine whether the zip code is unique. If the zip code is not unique,
another form/dialog is displayed (fclsLookup) - lookup form/dialog. The zip
code is passed to the lookup form/dialog by reference. I then load a...
|
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.
'first page
Private Sub btnOK_ServerClick(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnOK.Click
Response.Redirect("InputValues.aspx?Requestor=" &
|
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 "codebehind" page.
Function declaration:
Sub MyFunction(ByVal sender As Object, ByVal e As System.EventArgs)
|
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 button is clicked, check to see if
the record exists using input from a form. I want to pass that variable to
the button click Sub because if it doesn't exist then the record is
inserted and the user is directed to a different page. The variable I'm...
| |
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 System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
srcTable)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet)
at TryThis.Form1.save() in C:\Documents and Settings\Nick\My Documents\...
|
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 subroutine
Let's say theres a sub that creates buttons and I want it to receive as a parameter the address of the sub that handles the OnClick event for the button being created
How do I pass such a parameter
Thanks in advance
Richar
|
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) from the command line.
Pointers would help. : )
Bob
|
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 the form and select "Add Labels" from the context menu. This takes me to form2 where I can then select the checkbox if I want to turn on the label back on form1. This works great. I then select the "OK" button on form2 and executed the following code...
|
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
'just list local servers, set to false if you want to see all
servers
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |