This is a migrated thread and some comments may be shown as answers.

My.Application.Info

4 Answers 106 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Harald
Top achievements
Rank 2
Harald asked on 25 Dec 2014, 02:33 PM
If I want to read the product name with vb.net my.application.info in my WPF Project, I get an error message.

System.InvalidCastException wurde nicht behandelt.
  HResult=-2147467262
  Message=Das Objekt des Typs "TelerikWpfApp16.TelerikWpfApp16.Application" kann nicht in Typ "TelerikWpfApp16.Application" umgewandelt werden.
  Source=TelerikWpfApp16
  StackTrace:
       bei TelerikWpfApp16.My.MyWpfExtension.get_Application() in c:\users\hfrede\documents\visual studio 2013\Projects\TelerikWpfApp16\TelerikWpfApp16\My Project\MyExtensions\MyWpfExtension.vb:Zeile 20.
       bei TelerikWpfApp16.MainWindow.btnOK_Click(Object sender, RoutedEventArgs e) in c:\users\hfrede\documents\visual studio 2013\Projects\TelerikWpfApp16\TelerikWpfApp16\MainWindow.xaml.vb:Zeile 17.
       bei System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       bei System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       bei System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
...

4 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 26 Dec 2014, 12:47 PM
Hi,

The error message translated to English would be something like:
The object of the "TelerikWpfApp16.TelerikWpfApp16.Application" can not be converted to type 'TelerikWpfApp16.Application ". Would you please check how have you defined your namespaces? What logic have you implemented on your MainWindow.btnOK_Click?

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Harald
Top achievements
Rank 2
answered on 27 Dec 2014, 04:41 PM
MainWindow.btnOK_Click-Code:

MyConfigTable.ReadXml(My.Application.Info.DirectoryPath & "\" & "configuration.xml")

Before I used in this project the Telerik controls, this call has worked.
0
Harald
Top achievements
Rank 2
answered on 27 Dec 2014, 06:45 PM
I have created a simple test project. Here is the XAML:

<Window x:Name="MyMainWindow" x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Title="MainWindow" Height="350" Width="525">
<Grid>

</Grid>
</Window>

VB-Code:

Class MainWindow

Private Sub MyMainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles MyMainWindow.Loaded

Me.MyMainWindow.Title = My.Application.Info.ProductName

End Sub
End Class

​Again, I get the same error message.
0
Dimitrina
Telerik team
answered on 29 Dec 2014, 09:28 AM
Hello,

May I ask you to try isolating the issue in a demo project illustrating your exact setup and attach it in a new support ticket ? You can also take a look at this blog post for a reference on how to isolate an issue. 

That way I can check it locally and advise further.

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Harald
Top achievements
Rank 2
Answers by
Dimitrina
Telerik team
Harald
Top achievements
Rank 2
Share this question
or