Telerik Forums
UI for WinForms Forum
1 answer
51 views

I still haven't found a solution to this problem: https://www.telerik.com/forums/cellvalidating-event-question

asked

1. When user inputs an invalid value for a cell, we can use ErrorText to show an error message in the RowHeaderColumn. Normally, the ErrorText will be cleared after the user corrects the value. Sometimes the user will just press Esc key to cancel the input value, in this case the CellValidating event won't get fired and the ErrorText will remain shown on the RowHeaderColumn. This behavior will make the user feel confused.

answered

1. CellValidating event occurs only when a cell value is changed. In case when Esc is pressed, the value remains the same and no validation is needed. However, you can handle CellEndEdit event in this case and reset the ErrorText property.


Private Sub grdURLs2_UserAddingRow(sender As Object, e As GridViewRowCancelEventArgs) Handles grdURLs2.UserAddingRow
    Try
        If TypeOf e.Rows(0) Is GridViewNewRowInfo AndAlso
        TryCast(e.Rows(0).Cells(0).ColumnInfo, GridViewDataColumn) IsNot Nothing AndAlso
           TryCast(e.Rows(0).Cells(1).ColumnInfo, GridViewDataColumn) IsNot Nothing Then
            If e.Rows(0).Cells(0).Value Is Nothing OrElse
            String.IsNullOrEmpty(Trim(e.Rows(0).Cells(0).Value)) Then
                e.Cancel = True
                DirectCast(e.Rows(0), GridViewNewRowInfo).ErrorText = "Empty!"
            ElseIf e.Rows(0).Cells(1).Value Is Nothing OrElse
                String.IsNullOrEmpty(Trim(e.Rows(0).Cells(1).Value)) Then
                e.Cancel = True
                DirectCast(e.Rows(0), GridViewNewRowInfo).ErrorText = "Empty!"
            ElseIf e.Rows(0).Cells(1).Value IsNot Nothing Then
                For Each row In grdURLs2.Rows
                    If e.Rows(0).Cells(1).Value = row.Cells(1).Value Then
                        e.Cancel = True
                        DirectCast(e.Rows(0), GridViewNewRowInfo).ErrorText = "Exists!"
                    End If
                Next
            End If
        End If
    Catch ex As Exception
        txtError.Text = ex.Message & " - " & Format(Now, "HH:mm:ss")
    End Try
End Sub

Private Sub grdURLs2_CellEndEdit(sender As Object, e As GridViewCellEventArgs) Handles grdURLs2.CellEndEdit
    Try
        If TypeOf e.Row Is GridViewNewRowInfo Then
            DirectCast(e.Row, GridViewNewRowInfo).ErrorText = String.Empty
        End If
    Catch ex As Exception
        txtError.Text = ex.Message & " - " & Format(Now, "HH:mm:ss")
    End Try
End Sub

This doesn't work. The CellEndEdit event does not fire.


Nadya | Tech Support Engineer
Telerik team
 answered on 24 Jan 2025
2 answers
72 views
I've tried implement custom filter as per  Permanent editor in a filter cell - Telerik UI for WinForms instruction
but when I run that project drop down list looks too small to hold its content. Please look at attached screenshot. 

Could you advise me how to properly calculate size of dropdown, or in other way make it fit its content. The only way I found is to set 
 this.dropDown.MinSize = new Size(150, 30); 

inside CreateChildElements method. But I'm not sure this is the best way to fix this issue. Could you please advise me how to handle those kinds of size issues?

Ruslan
Top achievements
Rank 1
Iron
 answered on 23 Jan 2025
1 answer
98 views

Hi Support Team,

I am having difficulties using WinForms UI components in combination with System.Windows.Forms.TableLayoutPanel. I wanted to follow the suggestions of using this panel to create HDPI aware UIs.

Component nesting is like this:

  • RadForm
    • RadLayoutControl
      • LayoutControlTabbedGroup
        • LayoutControlGroupItem1
        • LayoutControlGroupItem2
          • LayoutControlItem1
            • TableLayoutPanel1
      • LayoutControlItem2
        • TableLayoutPanel2
      • LayoutControlItem3
        • RadButton1

When I am in the default "CSharp Form Editor" I'm not able to place the UI components into the TableLayoutPanel. The designer always tries to create a new LayoutControlItem in the RadLayoutControl. E.g. when trying to add a RadButton into the TableLayoutPanel2, it creates the RadButton1 right next to the TableLayoutPanel2 (or below/above;) into a new LayoutControlItem3, but not IN the desired column/row of the TableLayoutPanel2.

I tried a workaround by creating a standard Form and placing a TableLayoutPanel into it. Then adding all the UI components I want in it and afterwards copy+paste it into the LayoutControlGroupItem of another RadForm. However this approach seems to not attach it to any LayoutControlItem by using the Designer. It just gets added to the RadLayoutControl. I then tried to manually write the Designer Code by looking at how the Example code is generated, but that also is not reliable and I'm having an issue with getting the TableLayoutPanel docked to the "manually created" LayoutControlItem.

My question:

  1. How can I get this to work or is this combination not intended/supported?

Environment

  • Visual Studio 2022 v17.12.4
  • .NET Framework 4.8
  • Telerik WinForms UI 2024.4.1113.48

Added my example project and a screenshot of the designer while dragging a new RadLabel (or similar) onto the TableLayoutPanel.

Edit1: Added another screenshot of intended behavior.

 

Thanks and regards,

Kai

Nadya | Tech Support Engineer
Telerik team
 answered on 23 Jan 2025
1 answer
116 views

I use the following code to group and format the group name.

Private Sub grdURLs2_GroupSummaryEvaluate(sender As Object, e As GroupSummaryEvaluationEventArgs) Handles grdURLs2.GroupSummaryEvaluate
    Try
        Dim groupRow As GridViewGroupRowInfo = TryCast(e.Context, GridViewGroupRowInfo)
        If e.SummaryItem.Name = "col1" Then
            If groupRow IsNot Nothing Then
                If e.Value IsNot Nothing Then
                    e.FormatString = e.Value
                Else
                    e.FormatString = ""
                End If
            End If
        End If
    Catch ex As Exception
        txtError.Text = ex.Message & " - " & Format(Now, "HH:mm:ss")
    End Try
End Sub

Everything works fine until I leave the group field empty. This code works fine with an empty field, but after restarting the program, it adds records with empty fields not to the same group, but creates a new one. After restarting the program, all fields are in the same group. What am I doing wrong and how can I do it right? Thank you!

P.S.: I figured out why this happens.

Then another question arises. How to check cells for empty values ​​when adding a record and not add records with empty cells (continue editing)? Or replace empty values ​​in cells with significant ones and add?

Nadya | Tech Support Engineer
Telerik team
 answered on 20 Jan 2025
1 answer
66 views

I am trying to programmatically set the width of the dropdown list when the user clicks the DropDownButton, but my items are getting cut off because I can't seem to find the width of the CheckBox on the list so I can pad the width. How can I get to that information?

 

TIA.

 

Mark

Nadya | Tech Support Engineer
Telerik team
 answered on 20 Jan 2025
1 answer
57 views

Hi there!

Recently i encountered the following error: 'You are trying to use a multi-threaded .NET object in a way that is not supported.  The ABL cannot be called on a thread other than the main thread.'. I've known for a while that the language used in my company doesn't support multi-tread, that's why we usually used the version '20' of the dll's but sometimes the "40" were also usable even being multi-thread. Check the following link for context.

However, after updating the 2020 dll's to the 2023, we've been encountering several problems with the "RadPivotGrid" object. We get constant errors and warnings (like the one i shared). So, I've been trying unsuccessfully to find the '20' version so i can force my company's application to run with a single thread, and i can't find it anywhere.

Can anyone help me find it? Preferably DLL's from the year 2023 and forward.

 

Thank you.

JP

 

Dinko | Tech Support Engineer
Telerik team
 answered on 17 Jan 2025
1 answer
65 views
Good morning
I have a question about RadGridView. On a .net form I added a RadGridView populated by code and it works perfectly. The only thing I don't understand is that, I select a row, and then by clicking a button I open another form to edit the data and so far everything is fine. I close the other form of the data modification, go back to the RadGridView, click on the row and instead of maintaining the position on the clicked row it moves to one of the initial rows. I can't understand why it doesn't stay on the clicked row after being on another form.
Sorry for the length of the post, I don't know if I can make myself understood, I hope someone can help me.
Best regards
Fabrizio
Nadya | Tech Support Engineer
Telerik team
 answered on 16 Jan 2025
2 answers
123 views

Hello,

I would like to have combo box column in GridView editable by user, so user can select from dropdown list or type it manually. I have two possible scenarios, one with column mapped to other table, so it should be really only some value from dropdown, but I want to have it editable because of more values, and second with just string value, but I want to offer a dropdown for selecting most common values. It doesn't work in any case. Selecting from dropdown list is ok, but when I type an option manually, it reverts back to original value:

I have found very similar question here, but it's older and I don't know, how he solved it, it doesn't work for me, or more precisely, I don't know what's the difference, I don't see any important point I have missed.
https://www.telerik.com/forums/editable-gridviewcomboboxcolumn
https://docs.telerik.com/devtools/winforms/controls/gridview/features/editing/editors/how-to/allow-end-users-to-add-items-to-dropdownlisteditor

I have column defined like this:

dc = new DbDataContext();
var col = rgv.Columns["colProjID"] as GridViewComboBoxColumn;
col.DataSource = dc.Proj2s.OrderBy(o => o.Code);
col.FieldName = "ProjID";
col.DisplayMember = "Code";
col.ValueMember = "ID";
col.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown;

If the solution isn't obvious, I can prepare test project, but I have it bound to database now, so it would take some time.

Marian
Top achievements
Rank 2
Bronze
Iron
Iron
 answered on 14 Jan 2025
2 answers
111 views

I have a grid with 60,000 records and I have the filter line at the top of the grid. When a user writes to the filter line, it takes a few minutes for the grid to be filtered.

Telerik version is 2021.2.511.40.

Are there any performance improvements in newer versions? Is there a guarantee that if we update the Telerik version this problem will be resolved?

F3M
Top achievements
Rank 2
Iron
Iron
 answered on 13 Jan 2025
2 answers
56 views

Hello!
1. How to correctly implement adding unique groups to the list and deleting non-existent ones?
The GroupSummaryEvaluate event does not occur when deleting the last entry in a group (deleting this group). That is, it is necessary for the ListBox to display the same groups as in the Grid.

lbGroups.DataSource = lstGroups.ToList
Public Class Form1
Dim lstGroups As New SortedSet(Of String)
Private Sub grdURLs2_GroupSummaryEvaluate(sender As Object, e As GroupSummaryEvaluationEventArgs) Handles grdURLs2.GroupSummaryEvaluate
        If lstGroups.Add(e.Value) Then
' code
        End If
End Sub
End Class

2. How to remove the Close button from the Search Bar?

For Each row In grdURLs2.TableElement.VisualRows
    If TypeOf row Is GridSearchRowElement Then
        Dim searchRow = TryCast(row, GridSearchRowElement)
        searchRow.SearchCellElement.CloseButton.Visibility = False
        Exit For
    End If
Next
Doesn't work.

Thank you!

Hell
Top achievements
Rank 1
Iron
Iron
Iron
 updated answer on 12 Jan 2025
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Form
Chart (obsolete as of Q1 2013)
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
CollapsiblePanel
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
Styling
Barcode
PopupEditor
RibbonForm
TaskBoard
Callout
NavigationView
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
SplashScreen
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?