Hello everyone

I have the following issue and i tried google but no success. I'm tired of this silverlight thing but i have no choice.

here is the problem:

I have a datagrid which populates itself from a database doing this

void svr1_getInformationCompleted(object sender, getInformationCompletedEventArgs e)
        {
            dgv.ItemsSource = e.Result.ToList(); 
        }

there is no problem there and I can see my datagrid with the information.

My datagrid has the following 3 columns:

Number, name, desc

And also i have a textbox named txtlastrep.

what i need to do is to get from column name the last row and display it on txtlastrep.

i tried several sites with different solutions but no success.

hope someone can help me. thanks in advance.

Recommended Answers

All 3 Replies

you can change this event as:

var returnList = e.Result.ToList();
dgv.ItemsSource = resultList;
txtlastrep.Text=(string) returnList[returnList.Count-1];

Hope this helps

you can change this event as:

var returnList = e.Result.ToList();
dgv.ItemsSource = resultList;
txtlastrep.Text=(string) returnList[returnList.Count-1];

Hope this helps

I'll try it right away. I'll let you know the results. Thanks

you can change this event as:

var returnList = e.Result.ToList();
dgv.ItemsSource = resultList;
txtlastrep.Text=(string) returnList[returnList.Count-1];

Hope this helps

Hi, it did not work. I tried your solution but gave error in

txtlastrep.Text=(string) returnList[returnList.Count-1];

it said that cannot convert type 'DashBoard.ServiceReference1.Data' to 'string'

then I tried

txtlastrep.Text =resultList[resultList.Count - 1].ToString();

but did not work either.

any other idea?? thanks in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.