xl_kid 22.06.2018 13:28
Predmet:Failed to load toolbox item

Imam klasu "CustomDataGridView" koju pokušavam da ubacim u projekt ali mi stalno javlja grešku "failed to load toolbox item". Goglao sam, pokušavao i ništa. Disappointed Na prethodnom projektu je radilo. CustomDataGridView je naslednica DataGrid-a i tako sam rešio problem entera u DataGrid-u.

Molim za pomoć Smiling

Gjoreski 22.06.2018 18:23
Predmet:Re: Failed to load toolbox item

Ja ne raazumem tvoj problem. Sta treba raditi ta klasa?

zxz 22.06.2018 22:07
Predmet:Re: Failed to load toolbox item

Kopirao si klas modul pretpostavljam.
E sad mozda nedostaje jos nesto vjerovatno.
Zakci primjer pa cemo rijesiti.

xl_kid 25.06.2018 06:13
Predmet:Re: Failed to load toolbox item

Klasa je za enter u DataGrid-u (enter umesto tab).

evo i koda
Public Class CustomDataGridView

Inherits DataGridView

Private _EnterMovesToNextCell As Boolean = True
<System.ComponentModel.DefaultValue(GetType(Boolean), "True")>
Public Property EnterMovesToNextCell() As Boolean
Get
Return _EnterMovesToNextCell
End Get
Set(ByVal value As Boolean)
_EnterMovesToNextCell = value
End Set
End Property 'EnterMovesToNextCell

Protected Overrides Function ProcessDialogKey(ByVal keyData As System.Windows.Forms.Keys) As Boolean
' handles key while in edit
Select Case (keyData And Keys.KeyCode)
Case Keys.Enter
If Me._EnterMovesToNextCell AndAlso (keyData And Keys.Modifiers) = Keys.None Then
myProcessTabKey(Keys.Tab)
Return True
End If
Case Keys.Tab
If Me.StandardTab Then
If (keyData And Keys.Modifiers) = Keys.Control Then
myProcessTabKey(keyData)
Return True
End If
Else
If (keyData And Keys.Modifiers) = Keys.None OrElse (keyData And Keys.Modifiers) = Keys.Shift Then
myProcessTabKey(keyData)
Return True
End If
End If
End Select
Return MyBase.ProcessDialogKey(keyData)
End Function 'ProcessDialogKey

Protected Overrides Function ProcessDataGridViewKey(ByVal e As System.Windows.Forms.KeyEventArgs) As Boolean
If Me._EnterMovesToNextCell AndAlso e.KeyCode = Keys.Enter Then
Return myProcessTabKey(e.KeyData)
End If
If Me.StandardTab Then
If e.Control AndAlso e.KeyCode = Keys.Tab Then
Return myProcessTabKey(e.KeyData)
Else
Return MyBase.ProcessDataGridViewKey(e)
End If
Else
If e.KeyCode = Keys.Tab Then
Return myProcessTabKey(e.KeyData)
Else
Return MyBase.ProcessDataGridViewKey(e)
End If
End If
End Function ' ProcessDataGridViewKey

Private Function myProcessTabKey(ByVal keyData As Keys) As Boolean
' return True if key processed
If ((keyData And Keys.Shift) = Keys.Shift) Then
Return Me.TabToPreviousCell
Else
Return Me.TabToNextCell
End If
End Function ' myProcessTabKey

Private Function TabToPreviousCell() As Boolean
Dim firstCol As DataGridViewColumn = Columns.GetFirstColumn(DataGridViewElementStates.Visible, DataGridViewElementStates.ReadOnly)
If firstCol Is Nothing Then ' no selectable columns
Return False
End If

Dim prevCol As DataGridViewColumn = Columns.GetPreviousColumn(Columns(CurrentCell.ColumnIndex), DataGridViewElementStates.Visible, DataGridViewElementStates.ReadOnly)
If prevCol Is Nothing Then
'see if we can go to the previous row, lastcol
Dim rowIndex As Integer = Rows.GetPreviousRow(Me.CurrentCellAddress.Y, DataGridViewElementStates.Visible, DataGridViewElementStates.ReadOnly)
If rowIndex <> -1 Then
SetCell(Me.Columns.GetLastColumn(DataGridViewElementStates.Visible, DataGridViewElementStates.ReadOnly).Index, rowIndex)
Return True
Else
Return False
End If ' rowIndex <> -1
Else
SetCell(prevCol.Index, Me.CurrentCellAddress.Y)
Return True
End If ' prevCol Is Nothing
End Function ' TabToPreviousCell

Private Function TabToNextCell() As Boolean
Dim firstCol As DataGridViewColumn = Columns.GetFirstColumn(DataGridViewElementStates.Visible, DataGridViewElementStates.ReadOnly)
If firstCol Is Nothing Then ' no selectable columns
Return False
End If

Dim nextCol As DataGridViewColumn = Columns.GetNextColumn(Columns(Me.CurrentCellAddress.X), DataGridViewElementStates.Visible, DataGridViewElementStates.ReadOnly)
If nextCol Is Nothing Then
' check if can go to next row firstcol
Dim rowIndex As Integer = Rows.GetNextRow(Me.CurrentCellAddress.Y, DataGridViewElementStates.Visible, DataGridViewElementStates.ReadOnly)
If rowIndex > Me.CurrentCellAddress.Y Then
Me.SetCell(firstCol.Index, rowIndex)
Return True
Else
Return False
End If ' rowIndex > Me.CurrentCellAddress.Y
Else
Me.SetCell(nextCol.Index, Me.CurrentCellAddress.Y)
Return True
End If ' nextCol Is Nothing
End Function ' TabToNextCell

Private Sub SetCell(ByVal colIndex As Int32, ByVal rowIndex As Int32)
Me.ClearSelection()
Me.SetSelectedCellCore(colIndex, rowIndex, True)
Me.SetCurrentCellAddressCore(colIndex, rowIndex, True, False, False)
End Sub ' SetCell
End Class ' CustomGridViewSkipReadOnly

Gjoreski 25.06.2018 16:28
Predmet:Re: Failed to load toolbox item

Ja ovde ne vidim nikakva klasa ovo su par funkcije ali klasu ne vidim.

zxz 25.06.2018 18:27
Predmet:Re: Failed to load toolbox item

Ovo je vbnet samo neznam koja verzija.
Klasa grida.
Kod mene nece da odradi posao.
U kojoj verziji vb-a je ovo radilo.

Gjoreski 25.06.2018 18:57
Predmet:Re: Failed to load toolbox item

Ovo je najverojatno 2017 , ili 2018

xl_kid 26.06.2018 11:44
Predmet:Re: Failed to load toolbox item

Visual Studio 2017

xl_kid 26.06.2018 11:55
Predmet:Re: Failed to load toolbox item

u prethodnom projektu je radilo ok. ista verzija isto sve. sada kada pokušam da ga uvezem javlja gore opisanu grešku.

zxz 28.06.2018 17:50
Predmet:Re: Failed to load toolbox item

Hoces reci da ti data grid kontrolu nemozes ucitati u talboxu niti je postaviti na formu.
ako je tako to nema beze sa ovim kodom.
Moras vidjeti sta ti je sa data gridom.
U stvari moras prvo da nam ucitas pravi naziv i putanju data grida u talboxu.