Telerik Forums
UI for WinForms Forum
4 answers
1.1K+ views

Hello there,

I'm trying to implement a basic barcode scanner into my winforms application with radGridView. I'd like to search the GridView using this barcode scanner, so I have to fill the searchbox programatically. This is successful: I scan a code, it appears in the box. I have to use the Form's KeyPreview property set to TRUE and the Form's KeyPress event (because the scan ends as soon as the scanner send a NewLine character). Here's the code:

private string qrCode=string.Empty;

private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
    qrCode+=e.KeyChar;
    if (e.KeyChar == (char) Keys.Return)
    {
        StartSearch();
    }
}

private void StartSearch()
{
    GridViewSearchRowInfo searchRow = this.grdMyGridView.MasterView.TableSearchRow;
    searchRow.SearchProgressChanged += mySearchResult;
    searchRow.Search(qrCode);
    qrCode=string.Empty;
}

private void mySearchResult(object sender, SearchProgressChangedEventArgs e)
{
    Console.WriteLine("Results: " + e.Cells.Count);
}

 

My problem is, that I always get 0 results. The searchbox has the search string, this is no problem. If I type this string manually into this box, I get results perfectly. I want my GridView to show the results of scanned strings. Is this possible?

Thanks again for your help!

Attila

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 07 Nov 2016
2 answers
217 views
I do not know how to do the following. I have in a form, layoutcontrol, which have several layoutControlItem with textbox. You can change the background color of the layoutcontrolitem (I want to be different from the color of the form).
Thank you
Oscar
Top achievements
Rank 1
 answered on 07 Nov 2016
1 answer
154 views
I am trying to set the text on Titlebar, but even after setting the text property in text primitive the text is not being appeared. I don't understand why it's been happening?
Dimitar
Telerik team
 answered on 07 Nov 2016
2 answers
406 views

I need to change the background color for input type controls (Textbox, etc...) when their property for ReadOnly is equal to True. Currently, it stays white and the font is bold. I'm new to VSB. I watched the videos and looked through the documentation, but I didn't see how to set the background color based on a control's ReadOnly property state. Is this possible? and if so, how is this done in VSB?

 

Thanks!

 

Gone2TheDogs
Top achievements
Rank 2
Iron
Veteran
 answered on 04 Nov 2016
3 answers
227 views

Hello!

 

I have a problem updating my sql db with my radGridView after successful binding. One of my sql column has 'bit' type, so the radGridView has a column with checkboxes. After I check/uncheck one of the checkboxes, it doesn't update my SQL unless I select another cell. Is there any solution to this problem? I use this event:

 

private void radGridView1_CellValueChanged(object sender, GridViewCellEventArgs e)        
{
             itemsTableAdapter.Update(telerikDataSet);
             ordersTableAdapter.Update(telerikDataSet);         
}

 

(I use table hierarchy. 'Orders' table is the parent, 'Items' table is the child. This is ok. I managed to solve that if I check the checkbox in the parent, all its child checkboxes will be checked too). This way:

 

private void radGridView1_ValueChanging(object sender, ValueChangingEventArgs e)         

{

            if (radGridView1.SelectedRows[0].Cells[3].ColumnInfo.HeaderText == "Closed")
           {
               if (radGridView1.SelectedRows[0].Cells["Closed"].IsCurrent)
               {
                   foreach (GridViewRowInfo item in radGridView1.SelectedRows)
                   {
                       GridViewHierarchyRowInfo hierarchyRow = item as GridViewHierarchyRowInfo;
                       if (hierarchyRow != null)
                       {
                           GridViewInfo currentView = hierarchyRow.ActiveView;
                           foreach (GridViewInfo view in hierarchyRow.Views)
                           {
                               hierarchyRow.ActiveView = view;
                               foreach (GridViewRowInfo row in hierarchyRow.ChildRows)
                               {
                                   radGridView1.ValueChanging -= radGridView1_ValueChanging;//without this getting infinite loop...
                                   row.Cells[4].Value = e.NewValue;
                                    ordersTableAdapter.Update(telerikDataSet);
                                    itemsTableAdapter.Update(telerikDataSet);
                                   radGridView1.ValueChanging += radGridView1_ValueChanging;
                               }
                           }
                           hierarchyRow.ActiveView = currentView;
                       }
                   }
               }
           }                    
}

Of course every other fields are working fine when I edit them: as soon as I hit enter, it updates SQL. But checkbox doesn't need enter...

Thanks for your help.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 04 Nov 2016
1 answer
237 views

I have a listview with custom listitems that include a radButtonElement. How do I change the backcolor of the button? I've tried

    Me.MatchButtonElement.ButtonFillElement.BackColor = Color.LightGreen
    Me.MatchButtonElement.ButtonFillElement.BackColor2 = Color.LightGreen
    Me.MatchButtonElement.ButtonFillElement.BackColor3 = Color.FromArgb(122, 223, 136)
    Me.MatchButtonElement.ButtonFillElement.BackColor4 = Color.FromArgb(142, 237, 143)

and various other approaches but nothing has worked so far.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 03 Nov 2016
5 answers
320 views

Please let me know where I am going wrong!

I've tried many ways, but for some reason when I test my maskedit field, I can't type anything in. No values are displayed as I type and the IFrame cursor doesn't move as I type. I can only Tab off the field.

Input:  1 - 999

-----------------------------

Mask:  nnn

Type: Numeric

Prompt Char: 0

---------------------------

On line 7 below, the field doesn't get set to "001"

01.Private Sub mtxtDaysElapsed_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles mtxtDaysElapsed.Validating
02.    'between 1 and 999 exclusive
03.    Dim nDaysElapsed = 0
04. 
05.    Try
06.        If mtxtDaysElapsed.Value = "" Or mtxtDaysElapsed.Value = "0" Then
07.            mtxtDaysElapsed.Value = "001"
08.        End If
09.        If Integer.TryParse(mtxtDaysElapsed.Value, nDaysElapsed) Then
10.            recPoVenmst.LateCutoffDays = nDaysElapsed.ToString
11.        Else
12.            e.Cancel = True
13.        End If
14.    Catch ex As Exception
15.        'error
16.    End Try
17.End Sub
Dimitar
Telerik team
 answered on 03 Nov 2016
1 answer
77 views

Hi,

Looks like I can't use Week, Hour, Minute and Second as a step for QueryableDateTimeGroupDescription, it is not implemented yet?

Alex

 

Hristo
Telerik team
 answered on 02 Nov 2016
8 answers
588 views
How do I access the selected value of a GridViewComboBoxColumn when the selected value changes? What gridview event should I be handling? Thanks!
Gone2TheDogs
Top achievements
Rank 2
Iron
Veteran
 answered on 02 Nov 2016
1 answer
106 views

Hi

I have a column with multiple data types. I'm using the EditorRequired event to set the editor as a RadDateTimeEditor or RadDropDownListEditor using the code below. This mostly works but I have two problems. 

1. With the country dropdown, I set dropDownStyle to DropDown. The editor allows me to type in any value but if the value is not one of the items in the list, as soon as I exit the cell the value disappears.

2. With the RadDateTimeEditor, I set the customFormat to "d" but when I select a value and exit the cell, it's showing the time as well as the date. How do I get it to show date only?

 

Private maritalStatuses() As String = {"Married", "In a De Facto Relationship", "Interdependent Relationship", "Engaged", "Separated", "Divorced", "Widowed", "Never Married"}

Private Countries() as String = {"", "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola"}

 

Private Sub dgv_EditorRequired(sender As Object, e As EditorRequiredEventArgs) Handles dgv.EditorRequired
        If dgv.CurrentColumn.Name = "ImportValue" Then
            Select Case dgv.CurrentRow.Cells("EditorType").Value
                Case radEditorType.DatePicker
                    Dim editor As RadDateTimeEditor = New RadDateTimeEditor
                    editor.CustomFormat = "d"
                    e.Editor = editor
                Case radEditorType.CountryDropDown
                    Dim editor As New RadDropDownListEditor
                    editor.DropDownStyle = RadDropDownStyle.DropDown
                    DirectCast(editor.EditorElement, RadDropDownListEditorElement).DataSource = Countries
                    DirectCast(editor.EditorElement, RadDropDownListEditorElement).AutoCompleteMode = AutoCompleteMode.SuggestAppend
                    e.Editor = editor
                Case radEditorType.MaritalStatusDropDown
                    Dim editor As New RadDropDownListEditor
                    DirectCast(editor.EditorElement, RadDropDownListEditorElement).DataSource = maritalStatuses
                    editor.DropDownStyle = RadDropDownStyle.DropDownList
                    e.Editor = editor
            End Select
        End If
    End Sub

Dimitar
Telerik team
 answered on 02 Nov 2016
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
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
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
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
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
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?