Subject |
Author |
Date |
|
Paddy
|
Dec 30, 2010 - 2:07 AM
|
Hi,
I am trying to use the Unbound Grid Control for the first time. I have the grid setup with four columns. The column names/Types are as follows:
Column 1: Text = ComputerType
Column 2: DateTime = ComputerTypeDateAdded
Column 3: DateTime = ComputerTypeDateModified
Column 4: ComboBox = ComputerTypeItemVisibility
When I click on the Add button, I am wanting to add a value from the Textbox (txtComputerType) to the first column, todays date to the second column, no date to the third column and True/False to the fourth column but have the option defaulted to True.
When I click on the Add button with my current logic, the item is not added and no errors are generated. How do you add this information using this control? I am familiar with the Microsoft ListView and was trying to go the same route as that but it isn’t doing anything.
Screen shot of the form is here: dl.dropbox.com/u/5335929/FormScreenShot.png
My code is as follows:
Private Sub cmdComputerTypeAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdComputerTypeAdd.Click
’Add an item to the grid
’Make sure that the ComputerType is unique
’If unique, add the item
’If not unique, do not add the item and notify the end user
’Computer Type = Text = ComputerType
’Date Added = DateTime = ComputerTypeDateAdded
’Date Modified = DateTime = ComputerTypeDateModified = addition doesnt apply because not applicable
’Item Visibility = ComboBox = ComputerTypeItemVisibility = True/False
With gridComputerType
Dim MyGridItem As GridItem
Dim TodaysDate As Date = Date.Today
For Each MyGridItem In .Rows
If Not MyGridItem.Value Is txtComputerType.Text.ToString.Trim Then ’item to be added doesnt exist
’add the item
’nothing happens, no errors
.Rows.Add(CType(MyGridItem.Value, Elegant.Ui.Grid.Row))
Else ’item to be added exists
’notify the end user
If MessageBox.Show("The item " & txtComputerType.Text.ToString.Trim & " already exists. Item must be unique;" & _
"therefore, it cannot be added to the list of available options.", _
"Item Already Exists", _
MessageBoxButtons.OK, _
MessageBoxIcon.Information, _
MessageBoxDefaultButton.Button1) = Windows.Forms.DialogResult.OK Then
With txtComputerType
’refocus the text box for end user modification
.Focus()
’select all text for easy editing
.SelectAll()
End With
End If
End If
Next MyGridItem
End With
End Sub
|
|
Paddy
|
Dec 30, 2010 - 7:55 PM
|
finally was able to add a row. resolved.
|
|
Paddy
|
Dec 30, 2010 - 7:27 PM
|
Ok, please disregard. I think I am making some progress.
|
|
Paddy
|
Dec 30, 2010 - 7:15 PM
|
Ok, I have worked out the late binding issue but when I click add, no errors and nothing is added. I am getting a little frustrated now! :)
My code is as follows. If I can’t get your control to work then I am not going to bother with it. It shouldn’t be this difficult to work with your controls.
Private Sub cmdComputerTypeAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdComputerTypeAdd.Click
’Add an item to the grid
’Make sure that the ComputerType is unique
’If unique, add the item
’If not unique, do not add the item and notify the end user
’Computer Type = Text = ComputerType
’Date Added = DateTime = ComputerTypeDateAdded
’Date Modified = DateTime = ComputerTypeDateModified = addition doesnt apply because not applicable
’Item Visibility = ComboBox = ComputerTypeItemVisibility = True/False
With gridComputerType
Dim MyDataRow As DataRow = .NewDataRow
Dim ComputerTypeTextCell As TextCell = CType(MyDataRow.AddNewCell(GetType(TextCell), ComputerType), TextCell)
Dim ComputerTypeDateAddedTextCell As TextCell = CType(MyDataRow.AddNewCell(GetType(DateTimeCell), ComputerTypeDateAdded), TextCell)
Dim ComputerTypeDateModifiedTextCell As TextCell = CType(MyDataRow.AddNewCell(GetType(DateTimeCell), ComputerTypeDateModified), TextCell)
Dim ComputerTypeItemVisibilityTextCell As TextCell = CType(MyDataRow.AddNewCell(GetType(ComboBoxCell), ComputerTypeItemVisibility), TextCell)
’add the items
ComputerTypeTextCell.DataValue = txtComputerType.Text.ToString.Trim
ComputerTypeDateAddedTextCell.DataValue = dteTodaysDate
ComputerTypeDateModifiedTextCell.DataValue = ""
ComputerTypeItemVisibilityTextCell.DataValue = "True"
End With
End Sub
|
|
Paddy
|
Dec 30, 2010 - 6:54 PM
|
I have been trying to work with your Unbound Grid and I am getting an error. Screen shot attached here: dl.dropbox.com/u/5335929/LateBindError.png I don’t even know if I am doing it right. Your documentation is not easy to follow at all!
|
|
Technical Support
|
Dec 30, 2010 - 8:32 AM
|
You can find the source code of the samples in C:\Program Files\FOSS Software Inc\Elegant Grid\Samples.
|
|
Paddy
|
Dec 30, 2010 - 8:46 AM
|
I installed Elegant Grid and C:\Program Files\FOSS Software Inc\Elegant Grid\Samples doesn’t exist.
|
|
Technical Support
|
Dec 30, 2010 - 12:36 PM
|
Sorry, starting from v.3.8, the samples are located in the following directory: C:\Users\All Users\Documents\FOSS Software Inc\Elegant Grid\Samples for Windows Vista and higher C:\Documents and Settings\All Users\Documents\FOSS Software Inc\Elegant Grid\Samples for Windows XP
|
|
Paddy
|
Dec 30, 2010 - 4:51 PM
|
I found them! However, there’re in C and I write in VB. Do you have any samples in VB.net?
|
|
Technical Support
|
Dec 30, 2010 - 6:32 AM
|
You can find the samples in the Elegant Grid install location.
|
|
Paddy
|
Dec 30, 2010 - 7:48 AM
|
I used the control that came with Elegant Ribbon, so wasn’t able to find the code samples. I have now downloaded and installed Elegant Grid. Once I get this control to work the way I intend, I intend on purchasing a license for it. I will see if I can figure this out on my own using your code sample. If not, I will be back to see if I can get some sample code.
|
|
Paddy
|
Dec 30, 2010 - 7:55 AM
|
After download, the help file is useless to me because it’s like the Microsoft one and I never understood it. The samples I got from downloading are compiled so can’t see the code. I am at a loss now!
|
|
Technical Support
|
Dec 30, 2010 - 5:22 AM
|
ou should use the UnboundGridControl.NewDataRow method in order to create a row. You can see how to use the unbound grid in the SimpleDemo sample (the Enum page).
|
|
Paddy
|
Dec 30, 2010 - 5:56 AM
|
I don’t understand.
I have also attempted to find the SimpleDemo sample and not able to locate.
|