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

Saving Location and Size to Text Fiels into Database

Hi all,
I have a simple problem but I don't know which is the best way to
solve it.
I need to savo into a table into access DB the location and the size
of a form.
Is there a way to save Location and Size into a single text field, on
I need 4 Field X,Y,Height and Width?
If yes, how can convert Location and Size into String and then Back to
a Location and Size to apply back to the form?

Many Thanks
Jun 27 '08 #1
6 1542
On May 27, 11:10 pm, Marcolino <marco.pozzu...@gmail.comwrote:
Hi all,
I have a simple problem but I don't know which is the best way to
solve it.
I need to savo into a table into access DB the location and the size
of a form.
Is there a way to save Location and Size into a single text field, on
I need 4 Field X,Y,Height and Width?
If yes, how can convert Location and Size into String and then Back to
a Location and Size to apply back to the form?

Many Thanks
Hi,
Sure it's possible. Forms have "location" and "size" property and you
can get them as strings.

' Assign size/location of current form to strings
Dim X As String = Me.Location.X.ToString()
Dim Y As String = Me.Location.Y.ToString
Dim width As String = Me.Size.Width.ToString
Dim height As String = Me.Size.Height.ToString

' And your string variables are ready to be recorded into your
database.

...and when you want to apply them after retrieving from your
database, simply set these properties from db's in form's load event.
Thanks,

Onur Güzel
Jun 27 '08 #2
You can construct a system.drawing.point from the x and y co-ordinates so
you could save them as either a single string or as two seperate fields. I
would save each as a seperate field as it would be easier to report upon.

However, if you want to store them as two strings (or one string) the code
below shows how to reconstruct the system.drawing.point from a comma
seperated string.

Kind regards,

Rob
Code follows:

Dim sLocation As String = ""

sLocation = Me.Location.X.ToString + "," + Me.Location.Y.ToString

Me.Location = New System.Drawing.Point(0, 0)
MsgBox("moved")

Me.Location = New System.Drawing.Point(Split(sLocation, ",")(0),
Split(sLocation, ",")(1))
MsgBox("moved back")

"Marcolino" <ma************@gmail.comwrote in message
news:1c**********************************@2g2000hs n.googlegroups.com...
Hi all,
I have a simple problem but I don't know which is the best way to
solve it.
I need to savo into a table into access DB the location and the size
of a form.
Is there a way to save Location and Size into a single text field, on
I need 4 Field X,Y,Height and Width?
If yes, how can convert Location and Size into String and then Back to
a Location and Size to apply back to the form?

Many Thanks
Jun 27 '08 #3
On 27 Mag, 22:36, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On May 27, 11:10 pm, Marcolino <marco.pozzu...@gmail.comwrote:
Hi all,
I have a simple problem but I don't know which is the best way to
solve it.
I need to savo into a table into access DB the location and the size
of a form.
Is there a way to save Location and Size into a single text field, on
I need 4 Field X,Y,Height and Width?
If yes, how can convert Location and Size into String and then Back to
a Location and Size to apply back to the form?
Many Thanks

Hi,
Sure it's possible. Forms have "location" and "size" property and you
can get them as strings.

' Assign size/location of current form to strings
Dim X As String = Me.Location.X.ToString()
Dim Y As String = Me.Location.Y.ToString
Dim width As String = Me.Size.Width.ToString
Dim height As String = Me.Size.Height.ToString

' And your string variables are ready to be recorded into your
database.

...and when you want to apply them after retrieving from your
database, simply set these properties from db's in form's load event.

Thanks,

Onur Güzel
Thanks for your suggestion,
I know this way, but i need 4 field into Database, but in this case I
have only 2 fields, one for location and one for size.
My question is is there a way to put location into database using only
one field and then convert back.

Thanks
Jun 27 '08 #4
On May 28, 12:01 am, Marcolino <marco.pozzu...@gmail.comwrote:
On 27 Mag, 22:36, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On May 27, 11:10 pm, Marcolino <marco.pozzu...@gmail.comwrote:
Hi all,
I have a simple problem but I don't know which is the best way to
solve it.
I need to savo into a table into access DB the location and the size
of a form.
Is there a way to save Location and Size into a single text field, on
I need 4 Field X,Y,Height and Width?
If yes, how can convert Location and Size into String and then Back to
a Location and Size to apply back to the form?
Many Thanks
Hi,
Sure it's possible. Forms have "location" and "size" property and you
can get them as strings.
' Assign size/location of current form to strings
Dim X As String = Me.Location.X.ToString()
Dim Y As String = Me.Location.Y.ToString
Dim width As String = Me.Size.Width.ToString
Dim height As String = Me.Size.Height.ToString
' And your string variables are ready to be recorded into your
database.
...and when you want to apply them after retrieving from your
database, simply set these properties from db's in form's load event.
Thanks,
Onur Güzel

Thanks for your suggestion,
I know this way, but i need 4 field into Database, but in this case I
have only 2 fields, one for location and one for size.
My question is is there a way to put location into database using only
one field and then convert back.

Thanks
Sorry if i misunderstood you, so you want to store location's X and Y
in a single string?

Then, would you mind concentrating size's height and width into one
string variable?

' To store
Dim location As String
location = "X:" & Me.Location.X & " " & "Y:" & Me.Location.Y
Thanks,

Onur Güzel
Jun 27 '08 #5
On May 28, 12:19 am, kimiraikkonen <kimiraikkone...@gmail.comwrote:

Then, would you mind concentrating size's height and width into one
string variable?

Sorry for my mistype, i meant:
"Then, would you mind concentrating location's X and Y into one
string variable?"

..and it's clear what i meant from the code :)

Thanks,

Onur Güzel
Jun 27 '08 #6
On 27 Mag, 22:55, "Rob Blackmore" <r...@robblackmore.comwrote:
You can construct a system.drawing.point from the x and y co-ordinates so
you could save them as either a single string or as two seperate fields. *I
would save each as a seperate field as it would be easier to report upon.

However, if you want to store them as two strings (or one string) the code
below shows how to reconstruct the system.drawing.point from a comma
seperated string.

Kind regards,

Rob

Code follows:

* * * * Dim sLocation As String = ""

* * * * sLocation = Me.Location.X.ToString + "," + Me.Location.Y..ToString

* * * * Me.Location = New System.Drawing.Point(0, 0)
* * * * MsgBox("moved")

* * * * Me.Location = New System.Drawing.Point(Split(sLocation, ",")(0),
Split(sLocation, ",")(1))
* * * * MsgBox("moved back")

"Marcolino" <marco.pozzu...@gmail.comwrote in message

news:1c**********************************@2g2000hs n.googlegroups.com...
Hi all,
I have a simple problem but I don't know which is the best way to
solve it.
I need to savo into a table into access DB the location and the size
of a form.
Is there a way to save Location and Size into a single text field, on
I need 4 Field X,Y,Height and Width?
If yes, how can convert Location and Size into String and then Back to
a Location and Size to apply back to the form?
Many Thanks- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -
Hi Rob,
following your suggestion i created this 4 function that do excatly
what i need.
Bye

Public Function LocationToString(ByVal l As Point) As String
Trace("", "Location=" & l.ToString)
Return l.X.ToString & ";" & l.Y.ToString
End Function

Public Function LocationFromString(ByVal s As String) As Point
Trace("", "Location=" & s)
LocationFromString.X = Split(s, ";")(0)
LocationFromString.Y = Split(s, ";")(1)
End Function

Public Function SizeToString(ByVal s As Size) As String
Trace("", "Size=" & s.ToString)
Return s.Width.ToString & ";" & s.Height.ToString
End Function

Public Function SizeFromString(ByVal s As String) As Size
Trace("", "Size=" & s)
SizeFromString.Width = Split(s, ";")(0)
SizeFromString.Height = Split(s, ";")(1)
End Function
Jun 27 '08 #7

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

Similar topics

10
by: Scott | last post by:
I'm new to ASP, but I've been programming in VB for several years, and I'm having a few issues with this ASP enhancement I'm working on. I've found ASP to be a lot different than what I'm use to...
6
by: Kevin Ingram | last post by:
Ok, this is probably a silly question but I just keep hitting a brick wall here. I usually develop my sites entirely in ASP and use a database for data storage, works great for me. I also...
1
by: adolph | last post by:
Using Access2000, I would like to resize an image then save it to a new file with the resized size. I'm taking pictures (JPGs) with my digitial set at 3.2 megs. I've figured out how to get my...
12
by: Jack | last post by:
Since, I have not got some desired advise, I am reposting this for some asnwer/valuable suggestion. Thanks. THE FOLLOWING IS A PART OF CODE FROM A ASP PAGE <% sql01 = "SELECT COUNT(*) AS...
12
by: tjonsek | last post by:
I get a generic error (not very helpful) when attempting to save a re-sized image back to its original location. Here is the code snippet: Dim g As System.Drawing.Image =...
4
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
13
by: Marc | last post by:
The first part of the below writes the name and location of all buttons on a from to a text file. The second part reads that information back in and recreates the buttons. My problem is reading...
2
by: jimdavidson | last post by:
I'm teaching myself PHP with limited success. I'm using PHP5 and dreamweaver. I have a basic drop down menu on a form. If the user forgets to enter some data I send him back to the form. What...
3
by: pozze | last post by:
Hi, I've just made the change from ASP to .net. I have a file (code below) that saves a user submitted file to a MS SQL 2005 database. It collects the file name, file size, file type, and lastly...
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: 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)...
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.