I think you are attempting to do something like...
int result = 0;
foreach (lvi item in items)
result += item.subitem * item.subitem;
is this what you are attempting to do? I am really confused by how you get 700 from that example. Just ignore in your next post the fact that the numbers are subitems, and pretend like they are already integers so your problem becomes a bit more clear to the rest of us.
That will iterate through all the ListViewItems in listview3's items collection.
With each item it will multiple the 4th subitem with the 5th subitem and add that to the result variable. Once the loop has completed, you are assigning that result variable to the Text property of the Label control.
So let's assume this ( using periods for decimal <US Standard> ):
row1: blah, blah, blah, blah, 3.5, 100
row2: blah, blah, blah, blah, 2.5, 100
result = 0
First Iteration of loop: 3.5 * 100 = 350 : result = result + 350, so result is now 350
Second Iteration of loop: 2.5 * 100 = 250 : result = result + 350, so result is now 600
result += (float)(lvi.SubItems.Text) * (float)(lvi.SubItems.Text);
And also note that result should now be a float, not an int. I didn't even consider that you were using "," as the decimal separator. I am so used to using ".", that I didn't even consider the alternative. Sorry for the confusion.
i need to get a cell value from each of the selected datagrid rows. i will then put these values in a t-sql delete from statement. i can't seem to find any clear direction on how to loop through a selected set in a datagrid and then get a particular cell value. any re-direction, or comments would be greatly appreciated.
List<int> selectedRowIndexes = new List<int>();
foreach(DataGridViewRow row in dataGrid.SelectedRows)
//To save bandwith and cputime you should make one query for deleting all the rows//instead of deleting one at a time.
... code for deleting the indexes ...
-- modified at 18:00 Friday 7th September, 2007
Fixed missing <> for the generic list.
your question is missing a lot of details. File.ReadAllLines ( from memory ) returns a string array from your file, so that's a good way to get out your username and password, is that the bit you're stuck on ? Log on to where ? What do textboxes have to do with it ? Is there a typo in your post, is the second textbox the password ? They are surely not named that ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
Thanks for the response,
I need to access these from the PC side cause these register values are controlled by user, and it woud be nicer to let him address regsters using their names and not the address value
I'm working on WPF project in which I need to implement ZoomIn / ZoomOut on Scrollviewer object with seperate pan zoom window. There are two types of transformation which can be applied i.e. Layout Transform & Render Transform. Now the problem is I want to use the best of both kind of transformation.
I have a pan zoom window which shows the view of my scroll viewer object.When the view of my scrollviewer object changes i notify to pan zoom window to reflect the view of scroll viewer object.
For transformation, scrollviewer object's three properties are important. ViewPortSize, ExtentSize and Offset. When ZoomIn is performed, ViewPortSize and ExtentSize remains same in both Layout and Render transformation while Offset value gets changed in layout transform but in Render transform scrollviewer object's offset value is not changing. Because of this in render transform, even if the view(or layout) of my scrollviewer object in main canvas has changed still I can not send the changed information to pan zoom window (as offset value is same).
So my problem is my ZoomIn / ZoomOut related requirements are perfectly satisfied using Render Transform but if I use Render transform I can not update my view in Pan Zoom Window. Can any one suggest me the work around for this problem.
(I want to implement the zooming in the same way as implemented in Microsoft Visio. Pressing ctrl key n mouse wheel move wil provide the zooming operation in visio)
In the book I'm reading there is only explanation about RadioButtons.
Are there multiple choice button class somewhere? whats the name?
I basically need this to ID data I want to delete from a textfile.(to know which line to delete)
any tips how do I do it? I read something about datatables and grids, is that related to what I want to do? where can I find how those classes work?
CheckBoxes are designed to have a checked, unchecked, intermediary states. But it depends on the framework/IDE for how to set the state settings.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.