473,322 Members | 1,755 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,322 software developers and data experts.

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 4378
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.Left
End Function

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


Nov 11 '07 #3

"lyle" <ly************@gmail.comwrote in message
news:11**********************@22g2000hsm.googlegro ups.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.googlegr oups.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.Left
End Function

Public Function FormTop&(ByRef Form As Form)
Dim FormRectangle As Rectangle
GetWindowRect Form.hWnd, FormRectangle
FormLeft = FormRectangle.Top
End Function
Public Function FormTop&(ByRef Form As Form)
Dim FormRectangle As Rectangle
GetWindowRect Form.hWnd, FormRectangle
FormTop = FormRectangle.Top
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.netwrote 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.googleg roups.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*******************@newssvr29.news.prodigy. 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.netwrote 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.google groups.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****@yawhodotcalm.notwrote in message
news:%2****************@TK2MSFTNGP02.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*******************@newssvr29.news.prodigy. 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.netwrote 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.googl egroups.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 #9

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

Similar topics

4
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. ...
6
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...
11
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...
7
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...
2
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...
0
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..)...
6
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...
4
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...
10
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
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...
1
isladogs
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...
0
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.