Announcement

Collapse
No announcement yet.

copy data from table to combo box

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • copy data from table to combo box

    Hello,
    Im looking to copy data from a table into the item data in a combobox.
    I have been able to read out the data in the table using for loops but having some trouble,
    i wish to take the values in position 1 of the table and copy to the item data position 1 of the combobox,
    then same for 2,3,4 ....etc. the number of items in the table will vary but ill use a count for this later.


    here is my code so far. not doing quite what i want but somebody may be able to spot the error in my ways.
    i belive the bold part is where ive mostly messed up
    for reference the name "cameras" is the name of my combobox

    thanks


    Code:
    addresses_table = TextFile.ReadToTable("AutoPlay\\Docs\\ip.txt"); 
    addresses_count = Table.Count(addresses_table);
    Dialog.Message("Notice", "number of cameras found = "..addresses_count.."", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    
    min = 1;  
    max = 3;
    step= 1;  
    num= 0;
    
    Debug.ShowWindow(true);
    Debug.SetTraceMode(true);
    
    
    
    for i,v in pairs(addresses_table) do
    
    for count = min, max, step do
    [B]	 ComboBox.InsertItem("Cameras", num, ""..v.."", "");
    	 num= num+1;[/B]
    
    	 
    end
    
    
    	--Dialog.Message("Notice", ""..i.." "..v.."", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end
    
    end
    Last edited by dalygav; 11-27-2015, 01:58 PM. Reason: adding more info

  • #2
    some prgress

    made some changes in the loop.
    seems to be copying the data nicely the way i want now

    Code:
    for i,v in pairs(addresses_table) do
    	--Dialog.Message("Notice", ""..i.." "..v.."", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    for count = min, max, step do
    
    	 ComboBox.InsertItem("Cameras", i, ""..v.."", "");
    	
     
    end

    --Dialog.Message("Notice", ""..i.." "..v.."", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end

    Comment

    Working...
    X
    😀
    🥰
    🤢
    😎
    😡
    👍
    👎