This project has moved. For the latest updates, please go here.

VB.net starting

Jan 12, 2014 at 1:34 PM
Hi. I long time work under VB6 and now i want try VB.net 2013.

I already lost 2 days for find something information about BT connection under VB.net.
Can anyone help me? I need only connect to BT (port 3).

I add in reference LEGO.Ev3.Desktop.dll. Just syntax VB very hard changed in VS.Net
Jan 12, 2014 at 3:57 PM
Most forums, including this one (to the best of my knowledge), are generally for more specific questions. It sounds to me like the best thing for you would be to buy a book on VB.NET 2013 and/or migrating from VB6 to VB.NET to become more comfortable with VB.NET before going any further. As for the Bluetooth component, I didn't really need to add anything other than what is mentioned on the Documentation page for Lego.EV3 (and of course the necessary namespaces) to be able to connect with Bluetooth. But if you are looking to connect with Bluetooth using your own code, you should probably take a look at the Windows.Devices.Bluetooth namespaces. There are a lot of relatively new classes in this namespace, so some of them may have slightly less help and examples online than other parts of .NET (but that will probably change in the near future), but people in many forums are relatively quick and knowledgeable about the topics. However, for the Windows.Devices.Bluetooth namespace I would suggest a forum that is more for general .NET or VB.NET questions than this one, which is intended primarily for Lego.EV3. I am not the moderator or in charge of this forum, I am simply giving these suggestions because there are more likely to be more people for your questions at other forums, but this forums has been great answering my questions specific to Lego.EV3. Good Luck!
Coordinator
Jan 12, 2014 at 6:44 PM
As njsokalski said, this isn't really a forum for basic VB.NET help, but check out http://channel9.msdn.com/Series/Visual-Basic-Development-for-Absolute-Beginners for a great series on learning from the ground up.
Jan 16, 2014 at 1:25 PM
Edited Jan 16, 2014 at 1:27 PM
Yup, i try use lego dll in VB.net project. And see examples about using other lib. And i know syntax old VB6. I can programming in VB.net on old syntax, it easy commands, functions, classes. I just can't starting use this lego libs. I need small help in part connect to port and declaration in VB.net. Maybe who use VB.net sent me project (i dont want yours secret code, just starting part ending on connection) on email (or just past here 3-4 strings) for i can check syntax. THis small problem stop my idea %)

And i understand if yours say - go learn %) I saying it too sometimes %)
Jan 16, 2014 at 3:47 PM
First, can you tell us what your code IS currently doing? If it is giving an error, tell us what the error is. Can you do a test to make sure it is actually trying to execute the code you have to connect? The code I used to connect is the following:

I declared a variable for the Brick (if you want to modify this to be a local variable you can, but then you will need to recreate and reconnect to the brick in every method):

Private ev3 As Brick

And in the Loaded event I have the following code to connect:

Me.ev3 = New Brick(New BluetoothCommunication())
AddHandler Me.ev3.BrickChanged, AddressOf Me.ev3_BrickChanged
Await Me.ev3.ConnectAsync()

Because the code uses asynchronous methods (the 3rd line with Await), be sure to include the ASync modifier for whatever method you place the code in, as follows:

Private Async Sub MainPage_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded

Hopefully this helps, and it may enable us to help you more if you include your current code and, if applicable, any errors. Good Luck!
Jan 17, 2014 at 6:05 AM
Thx! I try it tomorrow. I know how use assync in vb.net., In old VB6 we use timers,now it more easy ))