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

Home Posts Topics Members FAQ

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 1593
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.T oString()
Dim Y As String = Me.Location.Y.T oString
Dim width As String = Me.Size.Width.T oString
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.T oString + "," + Me.Location.Y.T oString

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

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

"Marcolino" <ma************ @gmail.comwrote in message
news:1c******** *************** ***********@2g2 000hsn.googlegr oups.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.comwrot e:
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.T oString()
Dim Y As String = Me.Location.Y.T oString
Dim width As String = Me.Size.Width.T oString
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.comwrot e:
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.T oString()
Dim Y As String = Me.Location.Y.T oString
Dim width As String = Me.Size.Width.T oString
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.comwrot e:

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...@robblackm ore.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.T oString + "," + Me.Location.Y.. ToString

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

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

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

news:1c******** *************** ***********@2g2 000hsn.googlegr oups.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 LocationToStrin g(ByVal l As Point) As String
Trace("", "Location=" & l.ToString)
Return l.X.ToString & ";" & l.Y.ToString
End Function

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

Public Function SizeToString(By Val s As Size) As String
Trace("", "Size=" & s.ToString)
Return s.Width.ToStrin g & ";" & s.Height.ToStri ng
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
14742
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 in VB. I've created an ASP interface where a user can select an email group that populates a listbox with those email addresses. If a user sees an email in that list that they do not want then they can remove it by clinking the Delete button...
6
609
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 sometimes save information to a text file on my server like c:\invoices\customername.txt for batch processing later... I use the FSO commands and it all works slick. Now, I have a new project: A client wants us to log in to their website on another...
1
2014
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 access program to find the pictures and show them as thumbnails so I can add a description and notes. I then rename and save these pictures to a different location and add a record to a table with the new file name and location. But the picture...
12
2238
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 reccount FROM Equipmenttbl " sql01 = sql01 & "WHERE Equipmenttbl.GrantID = " & GrantID
12
2019
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 = System.Drawing.Image.FromFile(Me.File1.Value) Dim thisFormat = g.RawFormat Dim imgOutput As New Bitmap(g, 800, 600) Dim strFileType As String Dim strFileName As String = File1.PostedFile.FileName
4
6727
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 code ?? thank you Pedro Leite From Portugal ------------------------------------
13
1989
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 the location value back in where I marked ?????????????????????. As it wont accept a string value? Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click
2
1483
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 I need help with is how to show what was selected the first time so that he doesn't have to reenter all data just the missing stuff. I'm really new at this and could use some direction. Thanks
3
2474
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 the binary data for the file. I can sucessfully take the files out of the databse again and display them in a data grid. I would like to resize the submitted file to a fixed size (say 180 x 120) before I upload it to the database and do this without...
0
9672
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10559
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
10601
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
9388
agi2029
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...
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
5652
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?
2
4023
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.