Windows 10: How do i get back a listbox item after a window closes in C# WPF

Discus and support How do i get back a listbox item after a window closes in C# WPF in Windows 10 Customization to solve the problem; I have 1 Listbox it takes items from TextBox, when an item is added to the listbox and the application is closed, upon opening the application the item... Discussion in 'Windows 10 Customization' started by Sahana_28, Apr 20, 2020.

  1. Sahana_28 Win User

    How do i get back a listbox item after a window closes in C# WPF


    I have 1 Listbox it takes items from TextBox, when an item is added to the listbox and the application is closed, upon opening the application the item added to the listbox will still be present.

    Use case:

    • User opens application.
    • User adds item called "Item 1" to listbox using button.
    • User closes application.
    • User opens application again and sees that "Item 1" is still in the listbox, and the added item hasn't been lost by the application closing.

    :)
     
    Sahana_28, Apr 20, 2020
    #1
  2. MrSeanKon Win User

    Enable visual styles in WPF application

    EUREKA!

    Steps:
    1) I made a Windows form (HostWPF namespace, Form1 is the form).
    2) I added a reference => System.Windows.Forms.Integration which contains classes that enable interoperation between the Windows Forms and WPF technologies. When you use System.Windows.Forms.Integration classes, you can host Windows Forms controls on WPF pages, and WPF elements in Windows Forms-based applications.
    3) Then added a control (damn Vi$ual $tudio 2010 does not allow to add a WPF window) but after adding I edited the XMAL code in the way I want *Wink How do i get back a listbox item after a window closes in C# WPF ;)
    4) The next steps are simple. Download the first attachment. But => see the photo.
    It crashes!!!!!
    5) Finally???
    We must use System.Windows.Forms.Application.Exit(); command because the WPF window behaves like a classical Windows Form.
    Download the second attachment. Note that the Windows form's name is Initial.
    Enjoy!
     
    MrSeanKon, Apr 20, 2020
    #2
  3. Kreij Win User
    Run time error (C# WPF application)

    Switching from Windows Forms programming to WPF (C#/XAML) will give you many headaches.
    Stick with it, though, as the advantages are worth the effort.
     
    Kreij, Apr 20, 2020
    #3
  4. How do i get back a listbox item after a window closes in C# WPF

    VB Listbox help

    ListBox is index-based. You can access an item via "MyListBox.Items(index)."


    A textbox can support the new line character if Multiline = true. If you want an empty line in a ListBox, you'll just have to add an zero-length item like so: MyListBox.Items.Add("")
     
    FordGT90Concept, Apr 20, 2020
    #4
Thema:

How do i get back a listbox item after a window closes in C# WPF

Loading...
  1. How do i get back a listbox item after a window closes in C# WPF - Similar Threads - listbox item window

  2. Clicking a jumplist item of packaged winforms/wpf apps on Windows 10 opens a "How do you...

    in Windows 10 Customization
    Clicking a jumplist item of packaged winforms/wpf apps on Windows 10 opens a "How do you...: DescriptionWhen clicking on a jumplist item on a Winforms or WPF app that has been installed via an app package, there is a popup showing a "How do you want to open this file" dialog, which should not appear. The app otherwise runs correctly with the correct arguments from...
  3. How do I get it back it back

    in Windows 10 Gaming
    How do I get it back it back: my game wasn't working so I ctrl a and ctrl d on all my files and I restarted my computer and I couldn't find the game I was trying to play and the app is called five m I tried downloading it again but it just doesn't do anything...
  4. How do I get it back it back

    in Windows 10 Software and Apps
    How do I get it back it back: my game wasn't working so I ctrl a and ctrl d on all my files and I restarted my computer and I couldn't find the game I was trying to play and the app is called five m I tried downloading it again but it just doesn't do anything...
  5. How do i get back missing file C:\window\system32\msdt.exe

    in Windows 10 Gaming
    How do i get back missing file C:\window\system32\msdt.exe: Hi i cant connect to the internet, i got a message that say "windows can not find'C:\Windows\system32\msdt.exe'. Make sure you type the name correctly, and then try again." on the command Promt i ran a scan via "sfc/scannow" and i got a message that say "for online repairs...
  6. How do i get back missing file C:\window\system32\msdt.exe

    in Windows 10 Software and Apps
    How do i get back missing file C:\window\system32\msdt.exe: Hi i cant connect to the internet, i got a message that say "windows can not find'C:\Windows\system32\msdt.exe'. Make sure you type the name correctly, and then try again." on the command Promt i ran a scan via "sfc/scannow" and i got a message that say "for online repairs...
  7. How do i get back missing file C:\window\system32\msdt.exe

    in Windows 10 BSOD Crashes and Debugging
    How do i get back missing file C:\window\system32\msdt.exe: Hi i cant connect to the internet, i got a message that say "windows can not find'C:\Windows\system32\msdt.exe'. Make sure you type the name correctly, and then try again." on the command Promt i ran a scan via "sfc/scannow" and i got a message that say "for online repairs...
  8. "Pinned Items" are Stupid. How do I get back the normal taskbar?

    in Windows 10 Ask Insider
    "Pinned Items" are Stupid. How do I get back the normal taskbar?: [ATTACH] Hey guys, So on Windows 7 the taskbar made perfect sense, you had your tiny icons in the quick launch area, and all the open programs would show up on the taskbar the right. But for Windows 10, they changed it, so now when I click one of my applications it opens...
  9. How do I get the cortana bar back at the top of my screen after accidentally closing it?

    in Cortana
    How do I get the cortana bar back at the top of my screen after accidentally closing it?: How do I get the cortana bar back at the top of my screen after accidentally closing it? https://answers.microsoft.com/en-us/windows/forum/all/how-do-i-get-the-cortana-bar-back-at-the-top-of-my/5456df64-c531-4234-b0ac-bc418a199b1b"
  10. How do I get Bluetooth back after a windows update.

    in Windows 10 Drivers and Hardware
    How do I get Bluetooth back after a windows update.: Please keep in mind that I have read almost every thread and have already tried Starting the Bluetooth Support Service under the services menu and that does not work. I have tried running windows updates again and no luck. I also have tried turning airplane mode on and off...