Note that there are some explanatory texts on larger screens.

plurals
  1. POConvert an array to object[]
    primarykey
    data
    text
    <p>I am working on a winforms application that uses Sybase Datawindow.net. Basically I have a datawindow that retrieves data (dw_retailer.Retrieve(id)) and what I get back is an object list. The datawindow itself excists of labels and textboxes and I bind the data like this</p> <pre><code>newRetailer.foto1 = ((object[])(dataWindowControl.PrimaryData.Rows[0]))[7].ToString(); newRetailer.foto2 = ((object[])(dataWindowControl.PrimaryData.Rows[0]))[6].ToString(); </code></pre> <p>What I want to do now is put a string into the object[] list like this</p> <pre><code>((object[])(_targetForm.dw_retailer.PrimaryData.Rows[0]))[5] = retailer.text; </code></pre> <p>But obviously that doesnt work.</p> <pre><code>((object[])(_targetForm.dw_retailer.PrimaryData.Rows[0])).SetValue(retailer.text,5); </code></pre> <p>That doenst work either (index out of range) altho it has 9 objects</p> <pre><code>_targetForm.dw_retailer.PrimaryData.Rows[0] {object[9]} object {object[]} </code></pre> <p>Tried it like this too</p> <pre><code>Array arrayList = _targetForm.dw_retailer.PrimaryData.Rows.ToArray(); arrayList.SetValue(retailer.text, 0,5); </code></pre> <p>Array is not multidimensional. Because I need the objects in the object so i need arrayList[0][5] but that doenst work either.</p> <p>I don't even know if it is just a setting I have to select in the DataWindow Designer Application. How do I convert the array to object[] so I can put it back in the _targetForm.dw_retailer.PrimaryData.Rows. Is it even possible to edit the datawindows?</p> <hr> <p>Still not working Marc</p> <pre><code>IList list = ((IList)(_targetForm.dw_retailer.PrimaryData.Rows[0])); list[5] = retailer.text; </code></pre> <p>retailer.text has the value "tekst" list[5] is unchanged.</p> <p>It's not exactly adding an item, more like editting one. About the index out of range, I know there were only 8 items in the list, that's why I find it strange that the fifth is index out or range. Maybe I just dont understand .SetValue() that well.</p> <p>Thanks for the IList tho! But how do I convert the IList back to object[]?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload