|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Move controls at runtimeHi Guys
I'm trying to get started on allowing the user move a button control around a Form. For example I have say 30 jobs to do. Each button is a job and clicking on it will reveal that job's details. The user wants not started jobs on the left of a Form, those in progress in the middle and completed on the right. I don't think it's not a drag and drop job. It's more "Move a control at runtime" by dragging it TIA johnb On May 7, 6:32 pm, johnb <jo***@discussions.microsoft.com> wrote:
> Hi Guys Hi,> I'm trying to get started on allowing the user move a button control around > a Form. For example I have say 30 jobs to do. Each button is a job and > clicking on it will reveal that job's details. The user wants not started > jobs on the left of a Form, those in progress in the middle and completed on > the right. > > I don't think it's not a drag and drop job. It's more "Move a control at > runtime" by dragging it > > TIA > johnb Refer to my old post that contains code how to move control at runtime: http://groups.google.com/group/microsoft.public.dotnet.languages.vb/browse_thread/thread/9752f427a4ca5061/f2f7c1e2456c8230?hl=en&q=dragging#f2f7c1e2456c8230 HTH, Onur Güzel Hi Onur
Thanks for the info, I'll try it out today. regards johnb Show quoteHide quote "Onur Güzel" wrote: > On May 7, 6:32 pm, johnb <jo***@discussions.microsoft.com> wrote: > > Hi Guys > > I'm trying to get started on allowing the user move a button control around > > a Form. For example I have say 30 jobs to do. Each button is a job and > > clicking on it will reveal that job's details. The user wants not started > > jobs on the left of a Form, those in progress in the middle and completed on > > the right. > > > > I don't think it's not a drag and drop job. It's more "Move a control at > > runtime" by dragging it > > > > TIA > > johnb > > Hi, > > Refer to my old post that contains code how to move control at > runtime: > > http://groups.google.com/group/microsoft.public.dotnet.languages.vb/browse_thread/thread/9752f427a4ca5061/f2f7c1e2456c8230?hl=en&q=dragging#f2f7c1e2456c8230 > > HTH, > > Onur Güzel > . > Onur,
That works a treat! But how do I persist(save) those new control postions, so that when the app is closed and opened the last positions are maintained. regards johnb Show quoteHide quote "johnb" wrote: > Hi Guys > I'm trying to get started on allowing the user move a button control around > a Form. For example I have say 30 jobs to do. Each button is a job and > clicking on it will reveal that job's details. The user wants not started > jobs on the left of a Form, those in progress in the middle and completed on > the right. > > I don't think it's not a drag and drop job. It's more "Move a control at > runtime" by dragging it > > TIA > johnb On May 8, 1:09 pm, johnb <jo***@discussions.microsoft.com> wrote:
Show quoteHide quote > Onur, Hi John,> That works a treat! But how do I persist(save) those new control postions, > so that when the app is closed and opened the last positions are maintained. > > regards > johnb > > "johnb" wrote: > > Hi Guys > > I'm trying to get started on allowing the user move a button control around > > a Form. For example I have say 30 jobs to do. Each button is a job and > > clicking on it will reveal that job's details. The user wants not started > > jobs on the left of a Form, those in progress in the middle and completed on > > the right. > > > I don't think it's not a drag and drop job. It's more "Move a control at > > runtime" by dragging it > > > TIA > > johnb You have a couple of choices. You can try to use My.Settings by defining control's Location property's X and Y coordinates. http://msdn.microsoft.com/en-us/library/saa62613(VS.80).aspx Plus, just save location's X and Y coordinates in a text-based file using File.WriteAllText: http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx Also, you can find an INI library to group each control's location in the same way you're storing locations in human-readable format: http://www.google.com/search?hl=en&client=firefox-a&hs=w9l&rls=org.mozilla%3Atr%3Aofficial&q=vb.net+ini+library&aq=f&aqi=&aql=&oq=&gs_rfai= You need to apply the settings in Form_Load and save anytime you want, preferably in Form_Close events. HTH, Onur Güzel Thanks Onur
since my last post I've been reading up on this and concluded that MySetting was an option. I read up on the methods you've outlined. Thanks once more johnb Show quoteHide quote "Onur Güzel" wrote: > On May 8, 1:09 pm, johnb <jo***@discussions.microsoft.com> wrote: > > Onur, > > That works a treat! But how do I persist(save) those new control postions, > > so that when the app is closed and opened the last positions are maintained. > > > > regards > > johnb > > > > "johnb" wrote: > > > Hi Guys > > > I'm trying to get started on allowing the user move a button control around > > > a Form. For example I have say 30 jobs to do. Each button is a job and > > > clicking on it will reveal that job's details. The user wants not started > > > jobs on the left of a Form, those in progress in the middle and completed on > > > the right. > > > > > I don't think it's not a drag and drop job. It's more "Move a control at > > > runtime" by dragging it > > > > > TIA > > > johnb > > Hi John, > > You have a couple of choices. You can try to use My.Settings by > defining control's Location property's X and Y coordinates. > > http://msdn.microsoft.com/en-us/library/saa62613(VS.80).aspx > > Plus, just save location's X and Y coordinates in a text-based file > using File.WriteAllText: > > http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx > > Also, you can find an INI library to group each control's location in > the same way you're storing locations in human-readable format: > > http://www.google.com/search?hl=en&client=firefox-a&hs=w9l&rls=org.mozilla%3Atr%3Aofficial&q=vb.net+ini+library&aq=f&aqi=&aql=&oq=&gs_rfai= > > You need to apply the settings in Form_Load and save anytime you want, > preferably in Form_Close events. > > HTH, > > Onur Güzel > . > Hi Onur,
I'm having trouble getting My.Setting to update. I've added a Setting in the Project Properties Settings and added New name and call it Test, a Type and set to string with Scope set to user and Value to "TestOnly" Then on a Form added a button with the click event set it to My.Settings.Test = "XXXX" and My.Settings.Save() I then closed the project; re-opened it and the Test setting was still "TestOnly" Any ideas where I'm going wrong? TIA johnb Show quoteHide quote "Onur Güzel" wrote: > On May 8, 1:09 pm, johnb <jo***@discussions.microsoft.com> wrote: > > Onur, > > That works a treat! But how do I persist(save) those new control postions, > > so that when the app is closed and opened the last positions are maintained. > > > > regards > > johnb > > > > "johnb" wrote: > > > Hi Guys > > > I'm trying to get started on allowing the user move a button control around > > > a Form. For example I have say 30 jobs to do. Each button is a job and > > > clicking on it will reveal that job's details. The user wants not started > > > jobs on the left of a Form, those in progress in the middle and completed on > > > the right. > > > > > I don't think it's not a drag and drop job. It's more "Move a control at > > > runtime" by dragging it > > > > > TIA > > > johnb > > Hi John, > > You have a couple of choices. You can try to use My.Settings by > defining control's Location property's X and Y coordinates. > > http://msdn.microsoft.com/en-us/library/saa62613(VS.80).aspx > > Plus, just save location's X and Y coordinates in a text-based file > using File.WriteAllText: > > http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx > > Also, you can find an INI library to group each control's location in > the same way you're storing locations in human-readable format: > > http://www.google.com/search?hl=en&client=firefox-a&hs=w9l&rls=org.mozilla%3Atr%3Aofficial&q=vb.net+ini+library&aq=f&aqi=&aql=&oq=&gs_rfai= > > You need to apply the settings in Form_Load and save anytime you want, > preferably in Form_Close events. > > HTH, > > Onur Güzel > . > On May 11, 6:53 pm, johnb <jo***@discussions.microsoft.com> wrote:
Show quoteHide quote > Hi Onur, Hi,> I'm having trouble getting My.Setting to update. I've added a Setting in the > Project Properties Settings and added New name and call it Test, a Type and > set to string with Scope set to user and Value to "TestOnly" > > Then on a Form added a button with the click event set it to > My.Settings.Test = "XXXX" and > My.Settings.Save() > > I then closed the project; re-opened it and the Test setting was still > "TestOnly" Any ideas where I'm going wrong? > > TIA > johnb > > "Onur Güzel" wrote: > > On May 8, 1:09 pm, johnb <jo***@discussions.microsoft.com> wrote: > > > Onur, > > > That works a treat! But how do I persist(save) those new control postions, > > > so that when the app is closed and opened the last positions are maintained. > > > > regards > > > johnb > > > > "johnb" wrote: > > > > Hi Guys > > > > I'm trying to get started on allowing the user move a button control around > > > > a Form. For example I have say 30 jobs to do. Each button is a job and > > > > clicking on it will reveal that job's details. The user wants not started > > > > jobs on the left of a Form, those in progress in the middle and completed on > > > > the right. > > > > > I don't think it's not a drag and drop job. It's more "Move a control at > > > > runtime" by dragging it > > > > > TIA > > > > johnb > > > Hi John, > > > You have a couple of choices. You can try to use My.Settings by > > defining control's Location property's X and Y coordinates. > > >http://msdn.microsoft.com/en-us/library/saa62613(VS.80).aspx > > > Plus, just save location's X and Y coordinates in a text-based file > > using File.WriteAllText: > > >http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx > > > Also, you can find an INI library to group each control's location in > > the same way you're storing locations in human-readable format: > > >http://www.google.com/search?hl=en&client=firefox-a&hs=w9l&rls=org.mo... > > > You need to apply the settings in Form_Load and save anytime you want, > > preferably in Form_Close events. > > > HTH, > > > Onur Güzel > > . Couldn't reproduce it. Are you trying to get settings in Form_Load? After assigning a new value and after you save, it should run with the last value you've set. You can easily get the assigned string value just by calling "My.Settings.Test". Onur Güzel Onur,
The code is in the Form_Closing event. You've got it to work so I'm going wrong somewhere but where?? I shall leave it for an hour or 2 and have another go I'm after the Location property settings of a control so what should be in the Type cell in Settings, I selected System.Drawing.Point (and used others including String)with scope set to user without any success. I've used both VB.net 05 and 08. regards johnb Show quoteHide quote "Onur Güzel" wrote: > On May 11, 6:53 pm, johnb <jo***@discussions.microsoft.com> wrote: > > Hi Onur, > > I'm having trouble getting My.Setting to update. I've added a Setting in the > > Project Properties Settings and added New name and call it Test, a Type and > > set to string with Scope set to user and Value to "TestOnly" > > > > Then on a Form added a button with the click event set it to > > My.Settings.Test = "XXXX" and > > My.Settings.Save() > > > > I then closed the project; re-opened it and the Test setting was still > > "TestOnly" Any ideas where I'm going wrong? > > > > TIA > > johnb > > > > "Onur Güzel" wrote: > > > On May 8, 1:09 pm, johnb <jo***@discussions.microsoft.com> wrote: > > > > Onur, > > > > That works a treat! But how do I persist(save) those new control postions, > > > > so that when the app is closed and opened the last positions are maintained. > > > > > > regards > > > > johnb > > > > > > "johnb" wrote: > > > > > Hi Guys > > > > > I'm trying to get started on allowing the user move a button control around > > > > > a Form. For example I have say 30 jobs to do. Each button is a job and > > > > > clicking on it will reveal that job's details. The user wants not started > > > > > jobs on the left of a Form, those in progress in the middle and completed on > > > > > the right. > > > > > > > I don't think it's not a drag and drop job. It's more "Move a control at > > > > > runtime" by dragging it > > > > > > > TIA > > > > > johnb > > > > > Hi John, > > > > > You have a couple of choices. You can try to use My.Settings by > > > defining control's Location property's X and Y coordinates. > > > > >http://msdn.microsoft.com/en-us/library/saa62613(VS.80).aspx > > > > > Plus, just save location's X and Y coordinates in a text-based file > > > using File.WriteAllText: > > > > >http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx > > > > > Also, you can find an INI library to group each control's location in > > > the same way you're storing locations in human-readable format: > > > > >http://www.google.com/search?hl=en&client=firefox-a&hs=w9l&rls=org.mo... > > > > > You need to apply the settings in Form_Load and save anytime you want, > > > preferably in Form_Close events. > > > > > HTH, > > > > > Onur Güzel > > > . > > Hi, > > Couldn't reproduce it. Are you trying to get settings in Form_Load? > After assigning a new value and after you save, it should run with the > last value you've set. You can easily get the assigned string value > just by calling "My.Settings.Test". > > Onur Güzel > . > On May 12, 11:01 am, johnb <jo***@discussions.microsoft.com> wrote:
Show quoteHide quote > Onur, Ok, here is my full shot for saving location of controls and re-> The code is in the Form_Closing event. You've got it to work so I'm going > wrong somewhere but where?? I shall leave it for an hour or 2 and have > another go > > I'm after the Location property settings of a control so what should be in > the Type cell in Settings, I selected System.Drawing.Point (and used others > including String)with scope set to user without any success. I've used both > VB.net 05 and 08. > > regards > johnb > > > > "Onur Güzel" wrote: > > On May 11, 6:53 pm, johnb <jo***@discussions.microsoft.com> wrote: > > > Hi Onur, > > > I'm having trouble getting My.Setting to update. I've added a Setting in the > > > Project Properties Settings and added New name and call it Test, a Type and > > > set to string with Scope set to user and Value to "TestOnly" > > > > Then on a Form added a button with the click event set it to > > > My.Settings.Test = "XXXX" and > > > My.Settings.Save() > > > > I then closed the project; re-opened it and the Test setting was still > > > "TestOnly" Any ideas where I'm going wrong? > > > > TIA > > > johnb > > > > "Onur Güzel" wrote: > > > > On May 8, 1:09 pm, johnb <jo***@discussions.microsoft.com> wrote: > > > > > Onur, > > > > > That works a treat! But how do I persist(save) those new control postions, > > > > > so that when the app is closed and opened the last positions are maintained. > > > > > > regards > > > > > johnb > > > > > > "johnb" wrote: > > > > > > Hi Guys > > > > > > I'm trying to get started on allowing the user move a button control around > > > > > > a Form. For example I have say 30 jobs to do. Each button is a job and > > > > > > clicking on it will reveal that job's details. The user wants not started > > > > > > jobs on the left of a Form, those in progress in the middle and completed on > > > > > > the right. > > > > > > > I don't think it's not a drag and drop job. It's more "Move a control at > > > > > > runtime" by dragging it > > > > > > > TIA > > > > > > johnb > > > > > Hi John, > > > > > You have a couple of choices. You can try to use My.Settings by > > > > defining control's Location property's X and Y coordinates. > > > > >http://msdn.microsoft.com/en-us/library/saa62613(VS.80).aspx > > > > > Plus, just save location's X and Y coordinates in a text-based file > > > > using File.WriteAllText: > > > > >http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx > > > > > Also, you can find an INI library to group each control's location in > > > > the same way you're storing locations in human-readable format: > > > > >http://www.google.com/search?hl=en&client=firefox-a&hs=w9l&rls=org.mo... > > > > > You need to apply the settings in Form_Load and save anytime you want, > > > > preferably in Form_Close events. > > > > > HTH, > > > > > Onur Güzel > > > > . > > > Hi, > > > Couldn't reproduce it. Are you trying to get settings in Form_Load? > > After assigning a new value and after you save, it should run with the > > last value you've set. You can easily get the assigned string value > > just by calling "My.Settings.Test". > > > Onur Güzel > > .- Hide quoted text - > > - Show quoted text - gaining the location on form_load as follows: Imagine you're dealing with a button and want to remember its last position, first off, on project settings page->settings tab, enter "Button1_X" and "Button1_Y" on "Name" column, set the both's type to "Integer", leave "Scope" as "User" and "Value" field(s) blank. Add the following code to your application: '----------------------------------------- Private Sub Form1_FormClosing _ (ByVal sender As System.Object, _ ByVal e As System.Windows.Forms.FormClosingEventArgs) _ Handles MyBase.FormClosing With My.Settings ' Assign values of current location's ' just before closing the form ..Button1_X = Button1.Location.X ..Button1_Y = Button1.Location.Y ' Save settings, so they'll 'be rememnbered on next launch My.Settings.Save() End With End Sub Private Sub Form1_Load _ (ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles MyBase.Load With My.Settings ' Apply saved location settings ' by creating a new instance of Point Button1.Location = New Point(.Button1_X, .Button1_Y) End With End Sub '----------------------------------------- Hope this gives some idea, Onur Güzel Hi Onur
Thanks for the code it worked fine. Where I was going wrong, in the Settings Value I was expecting to see the saved setting values. Antway over one problem and on to the next. Cheers Onur. Show quoteHide quote "Onur Güzel" wrote: > On May 12, 11:01 am, johnb <jo***@discussions.microsoft.com> wrote: > > Onur, > > The code is in the Form_Closing event. You've got it to work so I'm going > > wrong somewhere but where?? I shall leave it for an hour or 2 and have > > another go > > > > I'm after the Location property settings of a control so what should be in > > the Type cell in Settings, I selected System.Drawing.Point (and used others > > including String)with scope set to user without any success. I've used both > > VB.net 05 and 08. > > > > regards > > johnb > > > > > > > > "Onur Güzel" wrote: > > > On May 11, 6:53 pm, johnb <jo***@discussions.microsoft.com> wrote: > > > > Hi Onur, > > > > I'm having trouble getting My.Setting to update. I've added a Setting in the > > > > Project Properties Settings and added New name and call it Test, a Type and > > > > set to string with Scope set to user and Value to "TestOnly" > > > > > > Then on a Form added a button with the click event set it to > > > > My.Settings.Test = "XXXX" and > > > > My.Settings.Save() > > > > > > I then closed the project; re-opened it and the Test setting was still > > > > "TestOnly" Any ideas where I'm going wrong? > > > > > > TIA > > > > johnb > > > > > > "Onur Güzel" wrote: > > > > > On May 8, 1:09 pm, johnb <jo***@discussions.microsoft.com> wrote: > > > > > > Onur, > > > > > > That works a treat! But how do I persist(save) those new control postions, > > > > > > so that when the app is closed and opened the last positions are maintained. > > > > > > > > regards > > > > > > johnb > > > > > > > > "johnb" wrote: > > > > > > > Hi Guys > > > > > > > I'm trying to get started on allowing the user move a button control around > > > > > > > a Form. For example I have say 30 jobs to do. Each button is a job and > > > > > > > clicking on it will reveal that job's details. The user wants not started > > > > > > > jobs on the left of a Form, those in progress in the middle and completed on > > > > > > > the right. > > > > > > > > > I don't think it's not a drag and drop job. It's more "Move a control at > > > > > > > runtime" by dragging it > > > > > > > > > TIA > > > > > > > johnb > > > > > > > Hi John, > > > > > > > You have a couple of choices. You can try to use My.Settings by > > > > > defining control's Location property's X and Y coordinates. > > > > > > >http://msdn.microsoft.com/en-us/library/saa62613(VS.80).aspx > > > > > > > Plus, just save location's X and Y coordinates in a text-based file > > > > > using File.WriteAllText: > > > > > > >http://msdn.microsoft.com/en-us/library/system.io.file.writealltext.aspx > > > > > > > Also, you can find an INI library to group each control's location in > > > > > the same way you're storing locations in human-readable format: > > > > > > >http://www.google.com/search?hl=en&client=firefox-a&hs=w9l&rls=org.mo... > > > > > > > You need to apply the settings in Form_Load and save anytime you want, > > > > > preferably in Form_Close events. > > > > > > > HTH, > > > > > > > Onur Güzel > > > > > . > > > > > Hi, > > > > > Couldn't reproduce it. Are you trying to get settings in Form_Load? > > > After assigning a new value and after you save, it should run with the > > > last value you've set. You can easily get the assigned string value > > > just by calling "My.Settings.Test". > > > > > Onur Güzel > > > .- Hide quoted text - > > > > - Show quoted text - > > Ok, here is my full shot for saving location of controls and re- > gaining the location on form_load as follows: > > Imagine you're dealing with a button and want to remember its last > position, first off, on project settings page->settings tab, enter > "Button1_X" and "Button1_Y" on "Name" column, set the both's type to > "Integer", leave "Scope" as "User" and "Value" field(s) blank. > > Add the following code to your application: > > '----------------------------------------- > Private Sub Form1_FormClosing _ > (ByVal sender As System.Object, _ > ByVal e As System.Windows.Forms.FormClosingEventArgs) _ > Handles MyBase.FormClosing > > With My.Settings > ' Assign values of current location's > ' just before closing the form > ..Button1_X = Button1.Location.X > ..Button1_Y = Button1.Location.Y > > ' Save settings, so they'll > 'be rememnbered on next launch > My.Settings.Save() > End With > > End Sub > > Private Sub Form1_Load _ > (ByVal sender As System.Object, _ > ByVal e As System.EventArgs) _ > Handles MyBase.Load > > With My.Settings > ' Apply saved location settings > ' by creating a new instance of Point > Button1.Location = New Point(.Button1_X, .Button1_Y) > End With > > > End Sub > '----------------------------------------- > > > Hope this gives some idea, > > Onur Güzel > . >
Site for some reason, and forbidden
Download and upload on FTP with SSL How to work with Access 2003 in VB.net how to draw irregular shape and calculate its surface? ms sql # temp table - invalid object name in data source Any willing to help with reportviewer control in web project? Outlook 2007--checking if a folder exists Threading question - ensure execution of a block of code A few basic questions for a newb coming from VB6 Add image over other images |
|||||||||||||||||||||||