Looping through Ultragrid

You should be able to do something like this as well to accomplish the
same task, but without having to use a counter.

Any enumerated type will have this functionality



For each dr as DataRow in this.mainPanel1.detailPanel1.grdJobInfo.Rows

Messagebox.show(dr("PartNum"))

Next



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Mike Anstey
Sent: Wednesday, June 23, 2010 7:21 AM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Looping through Ultragrid





Here is a c# example from one of my sdk projects, it should translate to
a c# customization :
private int PartExists(string partNum)

{

int index = -1;

for (int i = 0; i < this.mainPanel1.detailPanel1.grdJobInfo.Rows.Count;
i++)

{

if
(this.mainPanel1.detailPanel1.grdJobInfo.Rows[i].Cells["PartNum"].Text
== partNum)

{

index = i;

break;

}

}

return index;

}

________________________________

From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
[mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On
Behalf
Of ksimon8fw
Sent: Wednesday, June 23, 2010 1:24 AM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: [Vantage] Looping through Ultragrid

I'm hoping someone can give me a little bit of sample code. I've got an
ultragrid, and based upon an event, I just need to loop through the rows
and perform a process based upon a value. I know what I want to do, I've
just been struggling with the syntax.

The basic process I'm looking for is:
FOR I = 1 to NumberOfRows
if valueofcell in row i = something ..
NEXT I

Does anyone have a snippet of code they would be able to share?

Thanks.
Kevin Simon

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]
I'm hoping someone can give me a little bit of sample code. I've got an ultragrid, and based upon an event, I just need to loop through the rows and perform a process based upon a value. I know what I want to do, I've just been struggling with the syntax.

The basic process I'm looking for is:
FOR I = 1 to NumberOfRows
if valueofcell in row i = something ..
NEXT I


Does anyone have a snippet of code they would be able to share?

Thanks.
Kevin Simon
It is probably easier to loop through the rows in the dataview that the grid is bound to....lots of code for this in the group messages

otherwise test the value of the ultragrid cell when the row layout is initialized..... I have some code somewhere for this

--- In vantage@yahoogroups.com, "ksimon8fw" <ksimon8fw@...> wrote:
>
> I'm hoping someone can give me a little bit of sample code. I've got an ultragrid, and based upon an event, I just need to loop through the rows and perform a process based upon a value. I know what I want to do, I've just been struggling with the syntax.
>
> The basic process I'm looking for is:
> FOR I = 1 to NumberOfRows
> if valueofcell in row i = something ..
> NEXT I
>
>
> Does anyone have a snippet of code they would be able to share?
>
> Thanks.
> Kevin Simon
>
If you want to base your loop on the front side dataView, here is the sample, they are 0 based.

for i as integer = 0 to ugdMisc.rows.count-1
if ugdMisc.rows(i).selected then
OrderNumber = ugdMisc.rows(i).Cells(2).Value.Tostring.Trim
LineNumber = ugdMisc.rows(i).Cells(9).Value.Tostring.Trim
end if
next i

If you want to base it on the dataTable in DataSet, this is the syntax

For i as integer = 0 to SalesAdapter.SalesOrdHedDtlData.OrderDtl.Rows.Count -1
if SalesAdapter.OrdHedDtlData.OrderDtl.Rows(i)("OrderNum").Tostring ="1000" then
end if
Next i

SalesAdapter is the name of instance of adapter
SalesOrdHedDtlData is the dataset
OrderDtl is the DataTable



________________________________
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of ksimon8fw
Sent: Wednesday, June 23, 2010 12:24 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Looping through Ultragrid



I'm hoping someone can give me a little bit of sample code. I've got an ultragrid, and based upon an event, I just need to loop through the rows and perform a process based upon a value. I know what I want to do, I've just been struggling with the syntax.

The basic process I'm looking for is:
FOR I = 1 to NumberOfRows
if valueofcell in row i = something ..
NEXT I

Does anyone have a snippet of code they would be able to share?

Thanks.
Kevin Simon



[Non-text portions of this message have been removed]
Thanks. I don't know why my mind was stuck on going through the grid, but
going the dataview worked like a charm.



Kevin



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
bw2868bond
Sent: Wednesday, June 23, 2010 6:48 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Looping through Ultragrid





It is probably easier to loop through the rows in the dataview that the grid
is bound to....lots of code for this in the group messages

otherwise test the value of the ultragrid cell when the row layout is
initialized..... I have some code somewhere for this

--- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"ksimon8fw" <ksimon8fw@...> wrote:
>
> I'm hoping someone can give me a little bit of sample code. I've got an
ultragrid, and based upon an event, I just need to loop through the rows and
perform a process based upon a value. I know what I want to do, I've just
been struggling with the syntax.
>
> The basic process I'm looking for is:
> FOR I = 1 to NumberOfRows
> if valueofcell in row i = something ..
> NEXT I
>
>
> Does anyone have a snippet of code they would be able to share?
>
> Thanks.
> Kevin Simon
>





[Non-text portions of this message have been removed]
Here is a c# example from one of my sdk projects, it should translate to
a c# customization :
private int PartExists(string partNum)

{

int index = -1;

for (int i = 0; i < this.mainPanel1.detailPanel1.grdJobInfo.Rows.Count;
i++)

{

if
(this.mainPanel1.detailPanel1.grdJobInfo.Rows[i].Cells["PartNum"].Text
== partNum)

{

index = i;

break;

}

}

return index;

}


________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of ksimon8fw
Sent: Wednesday, June 23, 2010 1:24 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Looping through Ultragrid




I'm hoping someone can give me a little bit of sample code. I've got an
ultragrid, and based upon an event, I just need to loop through the rows
and perform a process based upon a value. I know what I want to do, I've
just been struggling with the syntax.

The basic process I'm looking for is:
FOR I = 1 to NumberOfRows
if valueofcell in row i = something ..
NEXT I

Does anyone have a snippet of code they would be able to share?

Thanks.
Kevin Simon






[Non-text portions of this message have been removed]