StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Application Framework - V1
»
WinForms (How do I?)
»
Can not Get Loop to Work
Can not Get Loop to Work
Post Reply
Like
0
Can not Get Loop to Work
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
Terry Bottorff
Terry Bottorff
posted 13 Years Ago
ANSWER
Topic Details
Share Topic
Group: Forum Members
Posts: 448,
Visits: 12K
What am I missing? I tried the following code:
'For Each lobo As ResultsPerfsChecksRoughStockBO In Me.ResultsPerfsChecksRoughStockBO1.GetEnumerable
' cword = DecimalToText.ConvertDecimalToText(Me.ResultsPerfsChecksRoughStockBO1.netcheck)
' Me.ResultsPerfsChecksRoughStockBO1.amountinwords = cword
' y += 1
'Next
' Could Not Get the Above to Work because it would only do the
First Record
. So I put the following in
MessageBox.Show(Me.ResultsPerfsChecksRoughStockBO1.Sort)
MessageBox.Show(Me.ResultsPerfsChecksRoughStockBO1.Filter)
MessageBox.Show(Me.ResultsPerfsChecksRoughStockBO1.Count.ToString())
The First two messageboxes show nothing and the last one shows 10 which is correct. So I tried the following code and it only does the
first record
also?????
If Me.ResultsPerfsChecksRoughStockBO1.MoveFirst() Then
' Loop Thru All Records Making Sure NetCheck is Correct and Getting Words for Netcheck
Do
nnet = Me.ResultsPerfsChecksRoughStockBO1.checkamt + Me.ResultsPerfsChecksRoughStockBO1.groundmoney - Me.ResultsPerfsChecksRoughStockBO1.tax
cword = DecimalToText.ConvertDecimalToText(Me.ResultsPerfsChecksRoughStockBO1.netcheck)
Me.ResultsPerfsChecksRoughStockBO1.amountinwords = cword
nnet = 0.0
Loop While Me.ResultsPerfsChecksRoughStockBO1.MoveNext()
End If
I just can not see the trees for the forest. I know it has to be something weird I am doing but I don't know what it is. Any help would be appreciated. TIA.
Reply
Like
0
Ivan George Borges
Ivan George Borges
posted 13 Years Ago
ANSWER
Post Details
Share Post
Group: StrataFrame MVPs
Posts: 1.9K,
Visits: 21K
Hi Terry.
Try this one:
For Each lobo As ResultsPerfsChecksRoughStockBO In Me.ResultsPerfsChecksRoughStockBO1.GetEnumerable
cword = DecimalToText.ConvertDecimalToText(lobo.netcheck)
lobo.amountinwords = cword
y += 1
Next
Notice you are dealing with the
lobo
instance created for the loop.
Reply
Like
0
Terry Bottorff
Terry Bottorff
posted 13 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 448,
Visits: 12K
Sorry to say that did not work either????
Reply
Like
0
Edhy Rijo
E
Edhy Rijo
posted 13 Years Ago
ANSWER
Post Details
Share Post
E
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
Hi Terry,
Ivan's code is the correct way to handle the BO.GetEnumerable().
In your code I assume that the cword has been previously defined, but it is not really needed you can do it in a single line of code
lobo.amountinwords = DecimalToText.ConvertDecimalToText(lobo.netcheck)
The only reason I have seen BO.GetEnumerable() going crazy is when you have a Sort or Filter and based on your original post those are cleared, so I suggest you debug the loop to see what may be happening.
Edhy Rijo
Reply
Like
0
Terry Bottorff
Terry Bottorff
posted 13 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 448,
Visits: 12K
Well an interesting thing happened. While trying to debug the above problem as Edhy recommended, since I have a DevExpress Grid on my form with a BBS I was just entering different values to see if I could find out why it did the first record and skipped all of the rest. Since I have such a few records I have always been entering data to the bottom of the grid. But this time I stopped entering about half way through the records, and in debugging I noticed it did the first record and skipped to the record that I left it on in the grid???????? I was floored. I still have no clue as to why that happens since I even reloaded my BO because I could not get the loop to work?
But I put this statement in my code before the loop and it now seems to work great.
Me.GridView1.MoveFirst()
I'm sure this might be logical but it seems strange to me since I did reload my BO.?
TIA.
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Like
0
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search