Using CustomMessageBox with WP8 - vb.net

In my WP8 app I have to use the CustomMessageBox. I use VB.NET and saw here I had to use the WP Toolkit which I added to my XAML like this :
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
The thing I want to do is simple, it isn't complicated with other controls in the message box, just modifying the buttons text.
Now my problem is simple : I just can't create my CustomMessageBox Object. On the link I gave, you can see the example is :
CustomMessageBox messageBox = new CustomMessageBox()
with some parameters. It's C# but basically it should work with VB.NET this way :
Dim myMessageBox as CustomMessageBox = new CustomMessageBox()
But Visual Studio says "the type CustomMesageBox is not defined". Any idea ?
Thanks

Assuming you already downloaded the the toolkit and added it as project reference, possibly you missed adding Imports (using in C#):
Imports Microsoft.Phone.Controls

Related

Create a Windows Forms application from the command line

I am trying to follow the MSDN documentation ( Windows Forms from Command Line ) to create a windows forms application from a command line. I did the following:
Created a VB.net new project
Importing the following namespaces as directed in the MSDN documentation: ComponentModel, Drawing, Windows.Forms.
However I for some reason my VB code editor is not giving me the option to import the Windows.Forms namespace. See 1st pic below.
Also when I forcefully type it out I get the following warning message with a green squiggly line (see the second pic below). Can anyone pls tell me where I am going wrong?
The MSDN link as the next steps ask me to write the following piece of code: Public Class Form1 Inherits Form
Unless I include the Windows.Forms namespace the above code piece is giving me an error. So pls point out where I am going wrong?
When I created the project I selected the following option:

Vb.net Mobile Application

I've been assigned a school project in which we're asked to develop a survey app for device/mobile use using VB.net.
I've started learning some Visual Basic, yet I'm failing to understand the following. I've downloaded Visual Studio 2017, do I need to download something extra so that I'm able to program for a mobile device? Or what is it that I need to do? I'm quite confused, I'd really appreciate some sort of help with understanding what's going on. I've been searching on the Internet quite some time now, and all I've found is "Visual Basic for Windows Phone Developer Tools - RTW", which is a version for 2010 and I'm not quite sure if it's what I need anyway. Another thing I've found is Xamarin.
Any help will be highly appreciated and excuse me for such a dumb question.
You're probably looking for Xamarin. It lets you use C#, F# and VB.NET code to develop cross-platform apps including native apps for iOS and Android.
Note that Xamarin doesn't completely or directly support VB.NET. You'll have to do the following steps to get started:
Create a new C# solution of the type Mobile App (Xamarin.Forms). You need to have the Mobile Development with .NET workload installed for this.
In said solution, add a Visual Basic .NET Class Library (.NET Standard). After creating the project, right-click it, click Properties, and change the Default Namespace to match the existing C# project(s).
Right-click the VB.NET project again, click "Manage NuGet Packages", then install Xamarin.Forms.
After this, you will want to rename Class1.vb to App.vb. Paste the following starter / example code there:
Imports Xamarin.Forms
Public Class App
Inherits Application
Public Sub New()
Dim label = New Label With {
.HorizontalTextAlignment = TextAlignment.Center,
.FontSize = Device.GetNamedSize(NamedSize.Medium, GetType(Label)),
.Text = "Welcome to Xamarin.Forms with Visual Basic.NET"
}
Dim stack = New StackLayout With {
.VerticalOptions = LayoutOptions.Center
}
stack.Children.Add(label)
Dim page = New ContentPage
page.Content = stack
MainPage = page
End Sub
End Class
Update the Android and iOS projects so that they reference the Visual Basic .NET project(s), rather than the C# project created by the template. Right-click on the References node in the Android and iOS projects to open the Reference Manager. Untick the C# library and tick the Visual Basic .NET library instead. Do this for both iOS and Android. Finally, delete the C# project. You can now develop your Xamarin project in VB.NET by adding more .vb files as necessary.
Unfortunately, VB.NET has a few limitations in regards to Xamarin:
You can't write custom renderers or dependency service implementations in VB.NET. These must be written in C# or F#.
You can't include XAML pages in VB.NET projects. You'll have to use a workaround that involves including XAML pages in a seperate, C#-based, portable class library, referencing it, and populating the XAML models with VB.NET through databinding. Alternatively, this may be of help for using XAML with VB.NET.
More info can be found at Microsoft's website.
I know this question is three years old, and that lots of time has passed since that school project, but I hope this answer was helpful to you regardless, and / or that it will be helpful to others who have the same or a similar question. To anyone about to write Xamarin apps in VB.NET or who is currently doing so, I wish you the best of luck!

Cant add using Telerik.UI.Xaml.Controls.Grid namespace

I am trying to use the Telerik RadDataGrid in my project. For starting off I have just copied the code given the "Telerik Controls Example" app. But when I try adding the namespace "using Telerik.UI.Xaml.Controls.Grid" I get an error
"The name "RadDataGrid" does not exist in the namespace "using:Telerik.UI.Xaml.Controls.Grid".
I have been able to use the RadCustomHubTile easily till now but RadDataGrid is giving me problems. RadDataGrid does not appear in the toolbox also.
I have added Rad Controls for Windows 8 in the reference section.
I am using C#, xaml, visual studio 2012 and trying to build a windows 8 app.
Any help would be appreciated.
Thanx :)
For those who do not know the answer here it is.
Just add this namespace: xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
And in no time you can be using <telerik:RadGridView />!!!!

VB silverlight for windows phone "System.Xml.Linq"

I am having this line in two of my windows phone applications :
Dim doc = XDocument.Parse(e.Result)
in the one of these apps it is working fine , in the other one it seems wrong ...
actually it cant find the object "XDocument"
When i am typing :
Imports System.Xml.Linq
it send me bug a warning :
Warning 2
Namespace or type specified in the Imports 'System.Xml.Linq' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.
the only diference between the application that works and the applications that sends me back this bug and this worning is that the one is a simple windows phone page (the working one) and the other one is a panorama page :S
any ideas why i am having this warning ??
thank you
I think you might need to include the reference to System.XML.Linq first using Visual Studios "add reference" command (right click your project node in the project explorer, add reference).

Modify VB property template in VS2008

In VS2008 (VB.NET) when you type Public Property X As SomeType
and press enter, VS auto-generates the rest of that property definition for you.
I would like to be able to customize what VS generates.
Any thoughts on how to go about that? VS must have a template for it somewhere, eh?
Thanks.
I think that the Property generation uses an inbuilt macro. I haven't found it in the list of sample macros provided with VS. However, you can edit the DefineAProperty.snippet* file to modify it as per your requirement. Personally, though, I would suggest creating your own snippet rather than modifying the pre-installed ones.
Some links to more information/Snippet Editors:
Creating and using Snippets - MSDN
Code snippet editor for VB 2008
Snippet Designer - CodePlex