Advertisement

09.13.2007 at 07:35AM PDT, ID: 22826270
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

Adding next max row value to newly added row

Asked by itortu in Microsoft Visual Basic.Net

Tags: , ,

I've added a button to a Windows form that allows a user to move a selected row from datagrid 1 to datagrid 2.

Datagrid 2 has a column that holds sequential numbers 1, 2, 3, 4..named "priority order" but that does not exist on datagrid 1.

How can the next number be assigned to the newly added row after the user decides to move it from dg1 to dg2?

Here is the code that places the row from datagrid 1 to datagrid 2:

Private Sub btnMoveDown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMoveDown.Click
        If grdAvailableDistributors.Enabled Then
            'Make sure a row is selected first
            If (grdAvailableDistributors.RowSel > 0) Then
                grdAvailableDistributors.AllowDelete = True

                'Add the selected category to the assigned grid
                grdCurrentDistAssignment.Rows.Add()
                grdCurrentDistAssignment.SetData(grdCurrentDistAssignment.Rows.Count - 1, "Distributor #", _
                    grdAvailableDistributors.GetData(grdAvailableDistributors.RowSel, "Distributor #"))
                grdCurrentDistAssignment.SetData(grdCurrentDistAssignment.Rows.Count - 1, "Type", _
                    grdAvailableDistributors.GetData(grdAvailableDistributors.RowSel, "Type"))
                grdCurrentDistAssignment.SetData(grdCurrentDistAssignment.Rows.Count - 1, "Name", _
                    grdAvailableDistributors.GetData(grdAvailableDistributors.RowSel, "Name"))

                'Remove the selected category in the available grid
                grdAvailableDistributors.Remove(grdAvailableDistributors.RowSel)

                'Don't select anything in the source grid
                grdAvailableDistributors.Select(-1, -1, -1, -1)

                'Sort the grids
                grdAvailableDistributors.Sort(C1.Win.C1FlexGrid.SortFlags.Ascending, 0)
                grdCurrentDistAssignment.Sort(C1.Win.C1FlexGrid.SortFlags.Ascending, 0)

                Me.grdCurrentDistAssignment.Select(Me.grdCurrentDistAssignment.Count - 1, 0)
            End If
        End If
    End Sub


any help on this is very much appreciated.

Thank you. Start Free Trial
[+][-]09.13.2007 at 10:40AM PDT, ID: 19885624

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Tags: row, selected, sort
Sign Up Now!
Solution Provided By: AshleyBryant
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628