Telerik Forums
UI for WinForms Forum
2 answers
149 views

Hi,

I'm relatively new at programming, so please bare with me.

What I have:

On load fetching image files from folder and creating tiles with those images.

Also, I have an event handler when a file added to folder, to add a new tile.

On load everything works fine and tiles are added. On event, the same sub that generates the tile fails in the "End Sub" with 

"An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll" and I'm unable to understand what I'm doing wrong.

My code: 

Imports System.IO
Imports System.Diagnostics
Imports Telerik.WinControls
Imports Telerik.WinControls.UI
Imports System.Threading
Imports System.ComponentModel


Public Class GridWindow
    Public watchfolder As FileSystemWatcher
    Dim itemCol As New List(Of String)
    Dim fileCount As Int32

    Public Sub fillGrid()
        Try

            Dim watchfdr As New FileSystemWatcher
            watchfdr.Path = My.Settings.sourcefldr
            Dim txtFiles = Directory.GetFiles(watchfdr.Path, "*.*", SearchOption.TopDirectoryOnly).[Select](Function(nm) Path.GetFileName(nm))
            If txtFiles.Count > 0 Then
                For Each filenm As String In txtFiles
                    itemCol.Add(filenm)
                Next
                fileCount = itemCol.Count()

            End If
            If itemCol.Count > 0 Then
                For Each filenm In itemCol
                    AddNewImageTile(filenm)
                Next
            End If
            watchfdr.NotifyFilter = IO.NotifyFilters.DirectoryName
            watchfdr.NotifyFilter = watchfdr.NotifyFilter Or _
                                       IO.NotifyFilters.FileName
            watchfdr.NotifyFilter = watchfdr.NotifyFilter Or _
                                       IO.NotifyFilters.Attributes

            AddHandler watchfdr.Created, AddressOf fileAdded
            watchfdr.EnableRaisingEvents = True



        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

 
    Private Sub fileAdded(ByVal source As Object, ByVal e As System.IO.FileSystemEventArgs)

        Try
            If e.ChangeType = IO.WatcherChangeTypes.Created Then
                Dim shortPath As String = e.FullPath.Substring(e.FullPath.LastIndexOf("\") + 1)
                AddNewImageTile(shortPath)
                'itemCol.Add(e.FullPath.ToString())
               
            End If
        Catch ex As Exception
            MessageBox.Show("Exception in fileAdded: " & ex.Message)

        End Try

    End Sub


    Private Sub AddNewImageTile(ImagePath)
        Try
            Dim img As Bitmap = CType(Image.FromFile(My.Settings.sourcefldr.ToString & "\" & ImagePath, True), Bitmap)
            Dim newTile As New RadTileElement()
            newTile.AutoSize = True
            newTile.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.Auto
            newTile.GradientStyle = Telerik.WinControls.GradientStyles.Linear
            newTile.Image = img
            newTile.Padding = New System.Windows.Forms.Padding(1)
            newTile.Size = New System.Drawing.Size(214, 276)        
            newTile.Row = RadPanorama1.Items.Count Mod Me.RadPanorama1.RowsCount
            newTile.Column = RadPanorama1.Items.Count / Me.RadPanorama1.RowsCount
            newTile.Visibility = ElementVisibility.Visible
            Me.RadPanorama1.Items.Add(newTile)

        Catch ex As Exception
            MessageBox.Show("Exception in AddNewImage: " & ex.Message)
        End Try

    End Sub



    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        fillGrid()

    End Sub



End Class

​

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 10 Aug 2015
2 answers
189 views

In a progress openedge form which inherits from Telerik.WinControls.UI.RadForm, I have added this line into the constructor :

 

ThemeResolutionService:ApplicationThemeName = "visualStudio2012Dark" .

 

However the theme is not being applied to the application. 

Can someone please help out?
Thanks

David
Top achievements
Rank 1
 answered on 10 Aug 2015
1 answer
121 views

The appointment not showed when  RadScheduler1.GroupType = GroupType.Resource

 

           dt = ObjDS.Tables(0)
            dt2 = ObjDS2.Tables(0)

            appointmentMappingInfo.Start = "StartTime"
            appointmentMappingInfo.End = "EndTime"
            appointmentMappingInfo.Summary = "TaskDetails"
          
            resourceMappingInfo.Id = "StaffID"
            resourceMappingInfo.Name = "StaffFullName"

            

            SchedSource.EventProvider.Mapping = appointmentMappingInfo
            SchedSource.EventProvider.DataSource = dt
            SchedSource.ResourceProvider.Mapping = resourceMappingInfo
            SchedSource.ResourceProvider.DataSource = dt2
          

            RadScheduler1.DataSource = SchedSource
            RadScheduler1.GroupType = GroupType.Resource​

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 07 Aug 2015
2 answers
304 views

Hi everyone,

 I've got a Hierarchical grid in my form. All of my Parent row have a button "+" to allow user to expand children row even if they haven't any child.

 Is there any way to hide this button when a parent doesn't have any child.

Thanks in advance.

Best regards

Tony

Tony
Top achievements
Rank 1
 answered on 06 Aug 2015
3 answers
118 views

I'm trying to figure out how to programmatically set up a hierarchical grid bound to a collection of objects. When I run the code shown below I get an exception when trying to expand the parent rows

In the form code behind-

public Form1()
    {
    InitializeComponent();
 
    List<Parent> parents = new List<Parent> ();
 
    parents.Add(CreateParent("Joe"));
    parents.Add(CreateParent("Bob"));
 
 
    this.parentBindingSource.DataSource = parents;
 
    }
 
private static Parent CreateParent (string parentName)
    {   
    var parent = new Parent () {ParentName = parentName};
 
    String childName = String.Format ("Child of {0}", parentName);
    parent.Children.Add(new Child() { Age = 2, ParentName = parentName, ChildName = "Child" });
    return parent;
    }

 Data class

public class Parent
    {
    private List<Child> m_children = new List<Child> ();
    public String ParentName { get; set; }
    public MyEnum FirstSecond { get; set; }
 
    public List<Child> Children { get { return m_children; } private set { m_children = value; } }
    }
 
public class Child
    {
    public String ChildName { get; set; }
    public String ParentName { get; set; }
    public MyEnum FirstSecond { get; set; }
    public int Age { get; set; }
    }
 
public enum MyEnum
    {
    First,
    Second
    }

Stefan
Telerik team
 answered on 06 Aug 2015
1 answer
128 views
Is there no StepAreaSeries available for the Winforms ChartView controls? I'd like to build a histogram, and this seems like the most obvious series to choose for histogram display.
Dimitar
Telerik team
 answered on 05 Aug 2015
1 answer
139 views

Hi Telerik support team,

May I know which control able to do this kind of display field(including the background color of blue and pink)? Please refer to the attachment.

Thank you.

 

Best regards,

Nicholas

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 05 Aug 2015
2 answers
119 views

Hi, 

 

May I know Telerik Winforms could do these 3 features in properties settings instead of using coding(Please refer to the attachment)? If yes please provide the steps to do this. If no, please provide advice or solutions to do these features.

Thank you.

 

Best regards,

Nicholas

Chai
Top achievements
Rank 1
 answered on 05 Aug 2015
1 answer
122 views

Hi,

I have a time ​column on a RadGridView. If the field is null, it defaults to the current time of day when the user starts typing in a new value. I want to change this behavior.

I need it to remain blank, and then default to 00:00 when the user start typing. FYI, the property on the datasource is a nullable DateTime.

Thanks.

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 04 Aug 2015
1 answer
1.1K+ views

I have a grid which shows employee data and enable user to edit the data. When edit command is pressed, it displays dropdown list for one of the column(Name). The dropdown value gets displayed without any issue however when edit command is pressed, the existing value within the dropdown gets hidden and first value '- Select -....' get displayed.

P.S: i followed this tutorial to add dropdown in Kendo Grid: http://www.sitereq.com/post/kendo-mvc-dropdown-lists-inside-inline-kendo-mvc-grids

Code Behind:

class EmployeeItem
{
public string Name{get; set;}
public string Code1{get;set;}

public string Code2{get;set;}​
public string CombinedValues{get;set;}  //this is combination of Name, Code1, Code2 delimited by comma

}

 

  Controller Code:

List<EmployeeItem> employeeList = service.GetEmployeeList();
ViewBag.EmployeeList = new SelectList(employeeList, "CombinedValues", "Name");

 

EditorTemplate Code (_EmployeeDropDown.cshtml):

@(Html.Kendo().DropDownList()
      .BindTo((IEnumerable)ViewBag.EmployeeList)
      .OptionLabel("- Select - ")
      .DataValueField("Value")
      .DataTextField("Text")
      .Name("EmployeeData")
)

View Code:
@(Html.Kendo().Grid(Model.employeeDetails)
      .Name("GridEmployeeDetails")
      .Columns(columns =>
      {
        columns.Command(command => { command.Edit(); }).Width("180px").Title("Action");
        columns.Bound(e => e.Name).Width("210px").EditorTemplateName("_EmployeeDropDown")
                                            .ClientTemplate("#:EmployeeData#");            
      })

So if the employeeList have values something like this:
Name = John, Code1 = 1, Code2 = 2, CombinedValues = John,1,2
Name = Matt, Code1 = 21, Code2 = 50, CombinedValues = Matt, 21, 50

In the grid, when i first view the grid it displays the Name, John in first row, Matt in second row. If i edit Matt row, the dropdown will show up with '-Select-' as selected value instead of 'Matt'. 
Does anyone know  how i can achieve that?
Also, once i make selection on dropdown, let's say from Matt to John, and hit inline Save button now the value changes to CombinedValues i.e. John,1,2 instead of just John under Name column.

Georgi Krustev
Telerik team
 answered on 04 Aug 2015
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
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
Wizard
TextBoxControl
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
WaitingBar
GroupBox
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
NavigationView
BindingNavigator
RibbonForm
Styling
Barcode
PopupEditor
TaskBoard
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Overlay
Security
LocalizationProvider
Dictionary
TreeMap
StepProgressBar
SplashScreen
Flyout
Separator
SparkLine
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
SpeechToTextButton
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?