Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Saving a form/listbox
New Posts  All Forums:Forum Nav:

Saving a form/listbox

post #1 of 7
Thread Starter 
I have a form that has two list boxes. The user will select items from listbox1 and move them over to listbox2. I've gotten all that to work, but I can't figure out how to have it save listbox2 when the user hits OK. Do I have to same to a text/XML file or is there another (better) way to do this? Thanks.
Karnak
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x2 550 @ 3.7Ghz Gigabyte MA-770T-UD3P Gigabyte 6850 1GB G.Skill 4GB DDR3 @ 1333 
Hard DriveOSMonitorPower
WDC 640GB Windows 7 Ultimate 64bit Acer X223Wbd Antec 650W 
CaseMouse
Antec 300 Logitech MX Revolution 
  hide details  
Reply
Karnak
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x2 550 @ 3.7Ghz Gigabyte MA-770T-UD3P Gigabyte 6850 1GB G.Skill 4GB DDR3 @ 1333 
Hard DriveOSMonitorPower
WDC 640GB Windows 7 Ultimate 64bit Acer X223Wbd Antec 650W 
CaseMouse
Antec 300 Logitech MX Revolution 
  hide details  
Reply
post #2 of 7
Assuming this is VB and not VBA, the easiest way would definitely be just save it to a plain text file.
i7
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7 920 D0 w/ HT On [4.01ghz @ 1.208v] Asus P6X58D Premium Asus HD5870 G.SKILL 6GB (3X2GB) DDR3 @ 1528MHz 
Hard DriveOptical DriveOSMonitor
OCZ Vertex Turbo 60GB FW1.5 2xSamsung Spinpoint F3 LG 8x Blu-ray Combo Drive Windows 7 64-bit Dell U2410 Rev. A04 
PowerCase
OCZ ModXStream Pro 700W V2.2 HAF 922 
  hide details  
Reply
i7
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i7 920 D0 w/ HT On [4.01ghz @ 1.208v] Asus P6X58D Premium Asus HD5870 G.SKILL 6GB (3X2GB) DDR3 @ 1528MHz 
Hard DriveOptical DriveOSMonitor
OCZ Vertex Turbo 60GB FW1.5 2xSamsung Spinpoint F3 LG 8x Blu-ray Combo Drive Windows 7 64-bit Dell U2410 Rev. A04 
PowerCase
OCZ ModXStream Pro 700W V2.2 HAF 922 
  hide details  
Reply
post #3 of 7
Thread Starter 
Quote:
Originally Posted by sidcitris View Post

Assuming this is VB and not VBA, the easiest way would definitely be just save it to a plain text file.

Oh ya, probably would have been helpful to mention what language. This is C#.
Karnak
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x2 550 @ 3.7Ghz Gigabyte MA-770T-UD3P Gigabyte 6850 1GB G.Skill 4GB DDR3 @ 1333 
Hard DriveOSMonitorPower
WDC 640GB Windows 7 Ultimate 64bit Acer X223Wbd Antec 650W 
CaseMouse
Antec 300 Logitech MX Revolution 
  hide details  
Reply
Karnak
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x2 550 @ 3.7Ghz Gigabyte MA-770T-UD3P Gigabyte 6850 1GB G.Skill 4GB DDR3 @ 1333 
Hard DriveOSMonitorPower
WDC 640GB Windows 7 Ultimate 64bit Acer X223Wbd Antec 650W 
CaseMouse
Antec 300 Logitech MX Revolution 
  hide details  
Reply
post #4 of 7
You can save it whichever way you want. Just read the selected item from the listbox object then write it to an open file object. There's so many ways this can be done it really depends on the reason you're wanting to write this to disk (ie, if it's going to be read in by another application, then ideally you'd want the output from this application to perfectly match the expected input in the next application).

In short, a few details would go a long way.wink.gif
post #5 of 7
Thread Starter 
In this application, there are two forms. In form2, I have 2 listboxes. Listbox1 has all the printers installed on the computer. The user selects certain printers and "moves" them over to listbox2. The printers that are selected in listbox2 will populate a dropdown in form1. At least that's the plan.
Karnak
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x2 550 @ 3.7Ghz Gigabyte MA-770T-UD3P Gigabyte 6850 1GB G.Skill 4GB DDR3 @ 1333 
Hard DriveOSMonitorPower
WDC 640GB Windows 7 Ultimate 64bit Acer X223Wbd Antec 650W 
CaseMouse
Antec 300 Logitech MX Revolution 
  hide details  
Reply
Karnak
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x2 550 @ 3.7Ghz Gigabyte MA-770T-UD3P Gigabyte 6850 1GB G.Skill 4GB DDR3 @ 1333 
Hard DriveOSMonitorPower
WDC 640GB Windows 7 Ultimate 64bit Acer X223Wbd Antec 650W 
CaseMouse
Antec 300 Logitech MX Revolution 
  hide details  
Reply
post #6 of 7
Quote:
Originally Posted by kurt1288 View Post

In this application, there are two forms. In form2, I have 2 listboxes. Listbox1 has all the printers installed on the computer. The user selects certain printers and "moves" them over to listbox2. The printers that are selected in listbox2 will populate a dropdown in form1. At least that's the plan.

Sorry, but that doesn't actually provide any more information: what are you planning on doing to the output once it's been written? (ie will you need CSV, XML, etc)
post #7 of 7
Thread Starter 
Once its written, it will be used to populate a dropdown (which then based on the selected printer in the dropdown will assign the printer to use). That or depopulate listbox2 if form 2 is reopened.

With what I'm doing, I think any file type would work.
Karnak
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x2 550 @ 3.7Ghz Gigabyte MA-770T-UD3P Gigabyte 6850 1GB G.Skill 4GB DDR3 @ 1333 
Hard DriveOSMonitorPower
WDC 640GB Windows 7 Ultimate 64bit Acer X223Wbd Antec 650W 
CaseMouse
Antec 300 Logitech MX Revolution 
  hide details  
Reply
Karnak
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x2 550 @ 3.7Ghz Gigabyte MA-770T-UD3P Gigabyte 6850 1GB G.Skill 4GB DDR3 @ 1333 
Hard DriveOSMonitorPower
WDC 640GB Windows 7 Ultimate 64bit Acer X223Wbd Antec 650W 
CaseMouse
Antec 300 Logitech MX Revolution 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Saving a form/listbox