I stuck against the wall again in implementing list of classes.

In the nutshell:

The idea is to put a LIST containing several CLASS, the Class content can only be manipulated and accessed with get and set method (which is already established). To add a value inside Job, Paycheck, and Securities you must use the add button available on the right side of their respective field. It must be selected to be registered as a value.

After all value is inserted, press the SAVE button and hit REPORT to see the results. Inside the report, use the left and right button to browse inserted data(which is each coressponding data stored inside a class e.g class1{Erwin,Male,Geek}, class2{John,Male,Genius}, etc)

The problems are:
-I couldn't figure out how to convert the checkedlistbox items on Form1 into a listbox in FormReport. I've tried to convert to string and array but no result.

-How to initialize the list and to access the list. Also how to implement the value changes in formReport?

The Solution(VC# 2010) Click Here

Any help regarding this one? Thanks in advance.

4 Years
Discussion Span
Last Post by Hi-Fi

Try this :

  1. Add this to 'Customer.cs' :

        List<string> Sec = new List<string>(); 
        public List<string> GetSec()
            return Sec;
        public void SetSec(string value)
        public void ClearSecList()
  2. Add this to 'Form1.cs' :

       void GetCheckedBoxes()
            for (int i = 0; i < this.checkedListBoxSecurity.CheckedItems.Count; i++) {
  3. Add this to 'button1_Click' (in Form1.cs) :

  4. Add this to FormReport.cs

     public void SetSecList(List<string> value)
            this.listBoxJaminan.DataSource = value;            
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.