473,804 Members | 2,184 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing size of textbox to match form

I have a single text box (a large one) in a form that pops up. I want the
text box to change size as the user changes the size of the form. However,
doing me.txtbox.width = me.width doesn't work, as the width value of the
form doesn't seem to change, even as the form is resized by the user.

How can get the textbox to always be the same size as the form that contains
it?
Oct 25 '07 #1
8 4415
If the database is not split, and if it can have several users at once, it could become tricky to
set the values in such a way that each user will have customized settings.

If so you have MUCH bigger issues than form resizing. In such a
situation it is not IF your database will become corrupted but WHEN.

Nov 6 '07 #2
On Nov 11, 11:14 am, "Phil Reynolds" <philr2...@msn. comwrote:
Actually, that doesn't work.
"I couldn't make that work." is always kinder and almost always more
correct.

Here's some code.It works!

Does it work for what you want to do?
I can't find your code in this thread (is it there?) so I have no
idea.

Can you make it work?
I don't care.

May it help someone else?
I hope.

Private Declare Function GetWindowRect Lib "user32" _
(ByVal hWnd As Long, lpRect As Rectangle) As Long

Private Type Rectangle
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Public Function FormLeft&(ByRef Form As Form)
Dim FormRectangle As Rectangle
GetWindowRect Form.hWnd, FormRectangle
FormLeft = FormRectangle.L eft
End Function

Public Function FormTop&(ByRef Form As Form)
Dim FormRectangle As Rectangle
GetWindowRect Form.hWnd, FormRectangle
FormLeft = FormRectangle.T op
End Function


Nov 11 '07 #3

"lyle" <ly************ @gmail.comwrote in message
news:11******** **************@ 22g2000hsm.goog legroups.com...
On Nov 11, 11:14 am, "Phil Reynolds" <philr2...@msn. comwrote:
>Actually, that doesn't work.

"I couldn't make that work." is always kinder and almost always more
correct.
True. But in this case, since there is no WindowLeft or WindowTop property
in Access 2000, it just doesn't work.

But thanks for the ediquette tip.
Nov 12 '07 #4
On Mon, 12 Nov 2007 02:31:19 GMT, "Phil Reynolds" <ph*******@msn. com>
wrote:
>
"lyle" <ly************ @gmail.comwrote in message
news:11******* *************** @22g2000hsm.goo glegroups.com.. .
>On Nov 11, 11:14 am, "Phil Reynolds" <philr2...@msn. comwrote:
>>Actually, that doesn't work.

"I couldn't make that work." is always kinder and almost always more
correct.

True. But in this case, since there is no WindowLeft or WindowTop property
in Access 2000, it just doesn't work.

But thanks for the ediquette tip.
They certainly do work, except for the small error in the second
function. It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.
Nov 12 '07 #5
On Nov 11, 12:35 pm, lyle <lyle.fairfi... @gmail.comwrote :
On Nov 11, 11:14 am, "Phil Reynolds" <philr2...@msn. comwrote:
Actually, that doesn't work.

"I couldn't make that work." is always kinder and almost always more
correct.

Here's some code.It works!

Does it work for what you want to do?
I can't find your code in this thread (is it there?) so I have no
idea.

Can you make it work?
I don't care.

May it help someone else?
I hope.

Private Declare Function GetWindowRect Lib "user32" _
(ByVal hWnd As Long, lpRect As Rectangle) As Long

Private Type Rectangle
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Public Function FormLeft&(ByRef Form As Form)
Dim FormRectangle As Rectangle
GetWindowRect Form.hWnd, FormRectangle
FormLeft = FormRectangle.L eft
End Function

Public Function FormTop&(ByRef Form As Form)
Dim FormRectangle As Rectangle
GetWindowRect Form.hWnd, FormRectangle
FormLeft = FormRectangle.T op
End Function
Public Function FormTop&(ByRef Form As Form)
Dim FormRectangle As Rectangle
GetWindowRect Form.hWnd, FormRectangle
FormTop = FormRectangle.T op
End Function

Thanks, Arch.

Nov 12 '07 #6
OK, you and Lyle are coming late to the game here, so I can see you're not
following completely.

This thread started with a question about resizing a textbox as a
form/window is resized. Rick Brandt answered that, and his solution worked
fine. No problem.

About a week later I replied to Rick again and asked how can I restore the
position of the window after the user closes it and reopens it, since
InsideHeight and InsideWidth (the properties that Rick referred me to for
resizing) only referred to the size.

Rick didn't respond, but then BruceM replied to use the MoveSize function to
restore that position. That was fine; but it didn't address how to store the
position parameters in the first place. So I replied to Bruce and asked how
I would get the Top and Left values for the window to store for later
reopening.

Bruce replied to use the WindowLeft and WindowTop properties to get to
position coordinates.

AND IT WAS TO THAT that I said, "That doesn't work. There is not WindowLeft
or WindowTop property of a form in Access 2000."

In other words, the question being asked was "How to get the Left and Top
properties," and the answer was, "Use WindowLeft and WindowTop." Those
properties don't exist in Access 2000, so the solution didn't work. Plain
and simple.

Thus, you wrote:
They certainly do work, except for the small error in the second
function.
Yes, but that was ALL that was being asked -- how to get the Left and Top
properties. And the answer was wrong. So, even if it was a "small error," it
was still 100% of what was being asked.
It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.
Correct. And so Lyle's solution works, and the original didn't. What's the
issue here?

Please don't get me wrong. I do appreciate BruceM taking the time to help
me. And when I said, "That doesn't work," I was not being rude or
unappreciative. It was just a simple statement of fact. I asked how to get
the Left and Top values for a window. He said, "Use the WindowLeft and
WindowTop." But those properties don't exist in Access 2000, so I said,
"That doesn't work." What's the issue here?
"Arch" <se*****@spam.n etwrote in message
news:h4******** *************** *********@4ax.c om...
On Mon, 12 Nov 2007 02:31:19 GMT, "Phil Reynolds" <ph*******@msn. com>
wrote:
>>
"lyle" <ly************ @gmail.comwrote in message
news:11****** *************** *@22g2000hsm.go oglegroups.com. ..
>>On Nov 11, 11:14 am, "Phil Reynolds" <philr2...@msn. comwrote:

Actually, that doesn't work.

"I couldn't make that work." is always kinder and almost always more
correct.

True. But in this case, since there is no WindowLeft or WindowTop property
in Access 2000, it just doesn't work.

But thanks for the ediquette tip.

They certainly do work, except for the small error in the second
function. It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.

Nov 12 '07 #7
When I post questions I sometimes forget to provide version information, and
when I answer questions I tend to assume the person who asked has the same
version as I do. I think this thread demonstrates the importance of
providing version information. Had you mentioned Access 2000 I might have
remembered to provide the caveat that my reply is based on Access 2003, and
that I can't be sure it is in other versions.
In any case, I took your reply to mean just what you explained: that the
properties are not part of Access 2000. Glad to hear you found something
that works.

"Phil Reynolds" <ph*******@msn. comwrote in message
news:ps******** ***********@new ssvr29.news.pro digy.net...
OK, you and Lyle are coming late to the game here, so I can see you're not
following completely.

This thread started with a question about resizing a textbox as a
form/window is resized. Rick Brandt answered that, and his solution worked
fine. No problem.

About a week later I replied to Rick again and asked how can I restore the
position of the window after the user closes it and reopens it, since
InsideHeight and InsideWidth (the properties that Rick referred me to for
resizing) only referred to the size.

Rick didn't respond, but then BruceM replied to use the MoveSize function
to restore that position. That was fine; but it didn't address how to
store the position parameters in the first place. So I replied to Bruce
and asked how I would get the Top and Left values for the window to store
for later reopening.

Bruce replied to use the WindowLeft and WindowTop properties to get to
position coordinates.

AND IT WAS TO THAT that I said, "That doesn't work. There is not
WindowLeft or WindowTop property of a form in Access 2000."

In other words, the question being asked was "How to get the Left and Top
properties," and the answer was, "Use WindowLeft and WindowTop." Those
properties don't exist in Access 2000, so the solution didn't work. Plain
and simple.

Thus, you wrote:
>They certainly do work, except for the small error in the second
function.

Yes, but that was ALL that was being asked -- how to get the Left and Top
properties. And the answer was wrong. So, even if it was a "small error,"
it was still 100% of what was being asked.
>It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.

Correct. And so Lyle's solution works, and the original didn't. What's the
issue here?

Please don't get me wrong. I do appreciate BruceM taking the time to help
me. And when I said, "That doesn't work," I was not being rude or
unappreciative. It was just a simple statement of fact. I asked how to get
the Left and Top values for a window. He said, "Use the WindowLeft and
WindowTop." But those properties don't exist in Access 2000, so I said,
"That doesn't work." What's the issue here?
"Arch" <se*****@spam.n etwrote in message
news:h4******** *************** *********@4ax.c om...
>On Mon, 12 Nov 2007 02:31:19 GMT, "Phil Reynolds" <ph*******@msn. com>
wrote:
>>>
"lyle" <ly************ @gmail.comwrote in message
news:11***** *************** **@22g2000hsm.g ooglegroups.com ...
On Nov 11, 11:14 am, "Phil Reynolds" <philr2...@msn. comwrote:

Actually, that doesn't work.

"I couldn't make that work." is always kinder and almost always more
correct.

True. But in this case, since there is no WindowLeft or WindowTop
property
in Access 2000, it just doesn't work.

But thanks for the ediquette tip.

They certainly do work, except for the small error in the second
function. It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.


Nov 12 '07 #8
Right -- I take responsiblity for not providing that version information.
And, as I noted, I don't really know what the issue is here, except that I
said, "It doesn't work," instead of, "I couldn't get it to work." But I
appreciate your taking the time to write either way! :-)
"BruceM" <ba****@yawhodo tcalm.notwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
When I post questions I sometimes forget to provide version information,
and when I answer questions I tend to assume the person who asked has the
same version as I do. I think this thread demonstrates the importance of
providing version information. Had you mentioned Access 2000 I might have
remembered to provide the caveat that my reply is based on Access 2003,
and that I can't be sure it is in other versions.
In any case, I took your reply to mean just what you explained: that the
properties are not part of Access 2000. Glad to hear you found something
that works.

"Phil Reynolds" <ph*******@msn. comwrote in message
news:ps******** ***********@new ssvr29.news.pro digy.net...
>OK, you and Lyle are coming late to the game here, so I can see you're
not following completely.

This thread started with a question about resizing a textbox as a
form/window is resized. Rick Brandt answered that, and his solution
worked fine. No problem.

About a week later I replied to Rick again and asked how can I restore
the position of the window after the user closes it and reopens it, since
InsideHeight and InsideWidth (the properties that Rick referred me to for
resizing) only referred to the size.

Rick didn't respond, but then BruceM replied to use the MoveSize function
to restore that position. That was fine; but it didn't address how to
store the position parameters in the first place. So I replied to Bruce
and asked how I would get the Top and Left values for the window to store
for later reopening.

Bruce replied to use the WindowLeft and WindowTop properties to get to
position coordinates.

AND IT WAS TO THAT that I said, "That doesn't work. There is not
WindowLeft or WindowTop property of a form in Access 2000."

In other words, the question being asked was "How to get the Left and Top
properties," and the answer was, "Use WindowLeft and WindowTop." Those
properties don't exist in Access 2000, so the solution didn't work. Plain
and simple.

Thus, you wrote:
>>They certainly do work, except for the small error in the second
function.

Yes, but that was ALL that was being asked -- how to get the Left and Top
properties. And the answer was wrong. So, even if it was a "small error,"
it was still 100% of what was being asked.
>>It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.

Correct. And so Lyle's solution works, and the original didn't. What's
the issue here?

Please don't get me wrong. I do appreciate BruceM taking the time to help
me. And when I said, "That doesn't work," I was not being rude or
unappreciative . It was just a simple statement of fact. I asked how to
get the Left and Top values for a window. He said, "Use the WindowLeft
and WindowTop." But those properties don't exist in Access 2000, so I
said, "That doesn't work." What's the issue here?
"Arch" <se*****@spam.n etwrote in message
news:h4******* *************** **********@4ax. com...
>>On Mon, 12 Nov 2007 02:31:19 GMT, "Phil Reynolds" <ph*******@msn. com>
wrote:
"lyle" <ly************ @gmail.comwrote in message
news:11**** *************** ***@22g2000hsm. googlegroups.co m...
On Nov 11, 11:14 am, "Phil Reynolds" <philr2...@msn. comwrote:
>
>Actually , that doesn't work.
>
"I couldn't make that work." is always kinder and almost always more
correct.

True. But in this case, since there is no WindowLeft or WindowTop
property
in Access 2000, it just doesn't work.

But thanks for the ediquette tip.
They certainly do work, except for the small error in the second
function. It is because there is no WindowLeft or WindowTop
properties in Access 2000 that Lyle provided these very nice
functions.



Nov 12 '07 #9

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

Similar topics

4
2450
by: Tony W | last post by:
Hi, I am trying to write a simple application to retrieve data from the Windows registry and insert it into textboxs on a windows form. So far I have one namespace containing two classess. The first class handles the form generation - (this was done using GUI form designer).
6
7902
by: Alex | last post by:
I am a newbie to ASP.NET... What I was trying to do... but yet to succeed in... I am building a customer info database... and on default, I want to display the customer's basic information in the TextBox on Page_Load... but, also allow user to update the information For example: Street1 of the home address
11
4584
by: Keith | last post by:
I apologize for those of you who think I'm posting on the same topic. It is not that I don't appreciate all of your comments - and I'm definitely reading them all - but I think I have a differing opinion of how I want to handle the 'user experience' in the application I'm creating. While I know I could allow the user to enter in number and alpha text - in a text box - and then tell them when the execuate a command "This is not numeric data", I...
7
2978
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and already formatted as "Shopping" ---Bold "for" -----Regular Now I want to underline whole text by preserving old style i.e. Bold and
2
1498
by: Peter Rilling | last post by:
I have controls on a page such as a textbox where I would like the font to match the rest of the page. The CSS style applied to the <body> tag does not seem to be used by the textbox. Can the textbox font be changed? Also, same thing for buttons.
0
1168
by: ego | last post by:
When designing a form I had insert a few objects near the left border of the form , But when changing to the Form view, the size of the form is changing , All my objects (Labels, TextBox, etc..) had move to the center and the size of the form had grow. How can I control this action? Thanks,
6
2860
by: andrew.ames | last post by:
Hi I have a pretty basic windows application created in Visual Studio 2005 and VB.NET. I set my Form's font to Arial 8.25pt, so when i added a label and a button they automatically have a font of Arial and 8.25pt. Great.
4
3379
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters the comments and clicks the save button then the date and the date will be stored in the mysql database. This is working fine. But my problem is when, after the user had made an entry the date in the calendar for which an entry has made should be...
10
21588
by: pt36 | last post by:
Hi I have a page with a form and a textbox. before to submit the form I want to chek if the inserted value in the textbox is already present in a database. So I need to pass the textbox value by a javascript link to another page to check. my code is <a href="javascript:location.href='page_check.php' "Go check </a> and this work and open page_check.php
0
9712
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, 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...
0
10343
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10341
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,...
0
10089
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
7634
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
5530
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
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
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
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.