[Gtk-sharp-list] Mono compile problem with " Use of unassigned local variable"

Peter Morgan pedromorgan at gmail.com
Sun Dec 10 04:20:40 EST 2006


Pretty new to gtk# and c# and this is my first attempt at an application.

Am having a problem with the contents of one function where I want to grab
the current treeview sort col, order and selected row, the reload the
liststore.Model before restoring back the col sort, order and selected row.

The probem is with the selected row.. I'm trying to get the current iter,
however the compiler dails to compile with the error
glade.cs(289,38): error CS0165: Use of unassigned local variable `currIter'
Compilation failed: 2 error(s), 3 warnings

I've even trapped the offending line in a boolean check, and it still dont
like it so I dont know what to do. Can anyone help pls. The offending line
is the last one

tia
Pete

//* Load data into liststore - first remember olde sort order and selected
row (single only)
int currSortCol;
SortType currSortType;
this.usersListStore.GetSortColumnId(out currSortCol, out currSortType);

TreeModel tModel;
bool iterFound = false;
TreeIter currIter ;
TreeSelection tSelect = this.treeView.Selection;
Array treePaths = tSelect.GetSelectedRows(out tModel);
// remove compiler warning
if(tModel != null)
    tModel = null;

foreach(TreePath tPath in treePaths){
    //TreeIter currIter;
    if(this.usersListStore.GetIter(out currIter, tPath)){
        Console.WriteLine("YES");
        iterFound = true;
    }
}

this.usersListStore.Clear();
string[] lines = tempString.Split('\n');
foreach (string line in lines){
    if(line != ""){
        string[] items = line.Split('\t');
        this.usersListStore.AppendValues (items[0], items[1],
items[2],items[3]);
    }
}
currSortCol = (currSortCol > 0) ? currSortCol : 1 ;
this.usersListStore.SetSortColumnId(currSortCol, currSortType);

if(iterFound == true ){
    //## This is the line the compiler complains about
    this.treeView.Selection.SelectIter(currIter);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20061210/71fbb951/attachment.html 


More information about the Gtk-sharp-list mailing list