473,836 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

prob setting location of button on form and resetting loc to orig

I placed a button on a form menustrip for the purpose of causing the
horizontal scrollbar of my form to appear so that I can access controls
outside of the form's current view (the controls are further to the right of
the form than the form's default width - which may take up the entire screen
for some users). The form contains panels which will contain either
textboxes or datagridviews. The button is located on the menustrip towards
the right side of the form - at the edge of the form's default view. If I
then move this button further to the right on the menustrip - it causes the
form's horizontal scrollbar to appear. This way a user can drag the
scrollbar to view the other controls which are located further to the right
of the form. Call this button the 'anchor' button.

In the default form view - the datagridviews (I guess actually the panels
containing the datagridviews) will display their vertical scrollbars (when
there are enough records to require the vertical scrollbars). So I
positioned the anchor button to be in view of the default form's view so that
the datagridviews can have their scrollbars. When I move the anchor button
to the right (through a menu click) the vertical scrollbars of the
datagridviews go out of site - until the user scrolls to the right (some of
the users have their resolution set to 640x480 - bad eyesight). Thus, I
need to be able to reposition this anchor button to its original location to
that the datagridview vertical scrollbars remain in view. The problem is
that when I try to reposition the anchor button to its original location - it
doesn't always go back. If I reposition the button in the beginning -
without scrolling the form horizontally - and the re-reposition the button -
it will go back to its original location. But if I scroll the form and then
try to reposition the button - it won't go back to its original position -
kinda like the new/current position becomes the original position. Here is
the code I am using to perform the positioning/repositioning.

Private Sub mnuExtendScroll Bar_Click(...) Handles mnuExtendScroll Bar.Click
Console.WriteLi ne("Before: " & btnAnchor.Locat ion.X.ToString)
If mnuExtendScroll Bar.Text.Equals ("Extend Bottom Scrollbar") Then
Me.btnAnchor.Lo cation = New System.Drawing. Point(1050, 3)
mnuExtendScroll Bar.Text = "De-extend Bottom Scrollbar"
Else
'--this is the original/default location of my anchor button
Me.btnAnchor.Lo cation = New System.Drawing. Point(858, 3)
mnuExtendScroll Bar.Text = "Extend Bottom Scrollbar"
End If
Console.WriteLi ne("After: " & btnAnchor.Locat ion.X.ToString)
End Sub

How can I make the location values not change? make it so the button will
only move to these two locations?

Thanks,
Rich
Oct 6 '08 #1
1 2910
I change my code slightly - changed Else to ElseIF:

Private Sub mnuExtendScroll Bar_Click(...) Handles mnuExtendScroll Bar.Click
Console.WriteLi ne("Before: " & btnAnchor.Locat ion.X.ToString)
If mnuExtendScroll Bar.Text.Equals ("Extend Bottom Scrollbar") Then
Me.btnAnchor.Lo cation = New System.Drawing. Point(1050, 3)
mnuExtendScroll Bar.Text = "De-extend Bottom Scrollbar"
ElseIf mnuExtendScroll Bar.Text.Equals ("De-extend Bottom Scrollbar") Then
'--this is the original/default location of my anchor button
Me.btnAnchor.Lo cation = New System.Drawing. Point(858, 3)
mnuExtendScroll Bar.Text = "Extend Bottom Scrollbar"
End If
Console.WriteLi ne("After: " & btnAnchor.Locat ion.X.ToString)
End Sub

I observed that if I scroll the form back to its original position and then
try to reposition the button - it will go back to its original position (may
take a few clicks though). I would like that button to go back as soon as I
click the menuItem without having to scroll the form back to its original
position.
"Rich" wrote:
I placed a button on a form menustrip for the purpose of causing the
horizontal scrollbar of my form to appear so that I can access controls
outside of the form's current view (the controls are further to the right of
the form than the form's default width - which may take up the entire screen
for some users). The form contains panels which will contain either
textboxes or datagridviews. The button is located on the menustrip towards
the right side of the form - at the edge of the form's default view. If I
then move this button further to the right on the menustrip - it causes the
form's horizontal scrollbar to appear. This way a user can drag the
scrollbar to view the other controls which are located further to the right
of the form. Call this button the 'anchor' button.

In the default form view - the datagridviews (I guess actually the panels
containing the datagridviews) will display their vertical scrollbars (when
there are enough records to require the vertical scrollbars). So I
positioned the anchor button to be in view of the default form's view so that
the datagridviews can have their scrollbars. When I move the anchor button
to the right (through a menu click) the vertical scrollbars of the
datagridviews go out of site - until the user scrolls to the right (some of
the users have their resolution set to 640x480 - bad eyesight). Thus, I
need to be able to reposition this anchor button to its original location to
that the datagridview vertical scrollbars remain in view. The problem is
that when I try to reposition the anchor button to its original location - it
doesn't always go back. If I reposition the button in the beginning -
without scrolling the form horizontally - and the re-reposition the button -
it will go back to its original location. But if I scroll the form and then
try to reposition the button - it won't go back to its original position -
kinda like the new/current position becomes the original position. Here is
the code I am using to perform the positioning/repositioning.

Private Sub mnuExtendScroll Bar_Click(...) Handles mnuExtendScroll Bar.Click
Console.WriteLi ne("Before: " & btnAnchor.Locat ion.X.ToString)
If mnuExtendScroll Bar.Text.Equals ("Extend Bottom Scrollbar") Then
Me.btnAnchor.Lo cation = New System.Drawing. Point(1050, 3)
mnuExtendScroll Bar.Text = "De-extend Bottom Scrollbar"
Else
'--this is the original/default location of my anchor button
Me.btnAnchor.Lo cation = New System.Drawing. Point(858, 3)
mnuExtendScroll Bar.Text = "Extend Bottom Scrollbar"
End If
Console.WriteLi ne("After: " & btnAnchor.Locat ion.X.ToString)
End Sub

How can I make the location values not change? make it so the button will
only move to these two locations?

Thanks,
Rich
Oct 6 '08 #2

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

Similar topics

9
30144
by: Ken | last post by:
How can I reset the initial form variables that are set with session statements when clicking on a button? I tried this but the function was not called: <?PHP function reset_form($none) { $_SESSION = array(); } ?> <form enctype="multipart/form-data" name="company_info" method="post" action="add_pic.php">
21
9930
by: | last post by:
Hi, I am setting the NumericUpDown .Value property and the ValueChanged event is NOT being fired. Does this ONLY get fired when I change it on the UI and not programatically? Thanks
4
3036
by: Luklrc | last post by:
Hi, I'm having to create a querysting with javascript. My problem is that javscript turns the "&" characher into "&amp;" when it gets used as a querystring in the url EG: /mypage.asp?value1=1&amp;value2=4&amp; ... which of course means nothing to asp.
0
2359
by: Stuart Norris | last post by:
Dear Group, I am having a problem setting SocketOptionName.SendTimeout on a client TCPIP application using the sockets in .NET. From the on-line help it is possible to set a SocketOptionName.SendTimeout for sends on TCPIP sockets. In all the tests that I have done with both Async and Sync sends the send returns immediately with the number of bytes sent (< 100 in my messages).
7
20773
by: charliewest | last post by:
Using .Net CF, i have created a 2 dimension ArrayList, and "binded" this list to a ComboBox control using the "DataSource" property. I have set the DisplaySource and ValueMember properties as well. The control populates well, both the display values, and selected values. However, when i try to "set" the SelectedValue or SelectedIndex properties, nothing happens.... The default blank value in the ComboBox is always selected. My code is: ...
1
3881
by: simon | last post by:
I have an unbound RTF2 control in an Access 2003 form which I set to show either unformatted text or else text with words and sentences highlighted. I do this by setting the PlainText property, getting back the rtfText and then adding the highlighting strings and resetting rtfText as below: sqry = "Select * from TextContent where FileID = " & ID Set rs = CurrentDb().OpenRecordset(sqry, dbOpenSnapshot) With rtfUnformatted ..rtfText = ""
4
4088
by: Ian Davies | last post by:
Hello I am struggling for a solution to clear some fields on my webpage that takes their values from some sessions My solution below works when the button is clicked twice. I sort of know why I have to click it twice to do the job (the first submit resets the sessions but this it too late to change the field values, which requires another submit to pick up the new session values). Problem is I cant think how to accomplish the resetting of...
5
2044
by: Finn Stampe Mikkelsen | last post by:
Hi How can i set a focus to a textbox in my codebehind page?? I have this WebForm, that takes information from a user and 2 buttons on the form. One that takes action on the entered information and one that resets the form... The second on, the reset button, i would like to set focus back to the first textbox on the form. I already have an onload in my body, which sets the
8
16100
by: Andrus | last post by:
..NET 2 Winforms application. How to create new setting and set it default value in userSettings section of app.config file or overwrite existing setting value ? I found code below in this list which modifies Application setting section but how to add new item to userSettings ? Andrus.
0
10854
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10257
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7794
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 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...
0
6981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
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...
0
5829
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4459
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
2
4022
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3116
bsmnconsultancy
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...

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.