Results 1 to 7 of 7

Thread: [RESOLVED] Wiring up Blend 3 with VB

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2010
    Posts
    69

    Resolved [RESOLVED] Wiring up Blend 3 with VB

    Hey guys...

    All I am trying to do is get my dumb button I created in Blend 4 work on a _Click event. I have the C# equivalent code, but I can't get it converted correctly...Here are both codes...I am using VS2010 just in case you want to know..

    C# Code Code:
    1. namespace TestButton1
    2. {
    3.     public partial class MainWindow:Window
    4.     {
    5.         public Page ( )
    6.         {
    7.             //Required to initialize variables
    8.             InitializeComponent ();
    9.         }
    10.     }
    11. }

    VB Code Code:
    1. Namespace TestButton1
    2.    
    3.     Public Partial Class MainWindow
    4.         Inherits Window
    5.  
    6.         Public Sub New ()
    7.         'This next line does not work and I don't know what is wrong...
    8.         Me.InitializeComponent ()
    9.        
    10.         End Sub
    11.  
    12. End NameSpace

    As soon as I can get this very first initialization down, I know I can get the rest of the events written fine.

    Thanks guys.

  2. #2
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,826

    Re: Wiring up Blend 3 with VB

    If you're using expression blend + VB and not C#, why not just create the blend project in VB, so it creates VB code?
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2010
    Posts
    69

    Re: Wiring up Blend 3 with VB

    thats what I did, but all it created was a class declaration and an end class statement..

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Wiring up Blend 3 with VB

    Perhaps you could define "doesn't work". Also, how exactly was that code generated? From the looks of it it should be getting auto-generated by the IDE when you add a new Window to your project. Is that what happened?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2010
    Posts
    69

    Re: Wiring up Blend 3 with VB

    well it's working now. JMC, the C# code with the initializecomponent () line was auto generated each time, but the VB code wasn't. Then, every time I tried to put in

    Public Sub New ( )
    InitializeComponent ()
    End Sub

    I would get an error saying InitializeComponent wasn't defined. I don't know what I changed or if something just got goofy or what, but now when I put in the "Public Sub New ()" it auto generates the rest of the code for me. It may have been the namespace declaration, because I left that out and the auto-generated code worked...I don't know. Thanks for everyone's input.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Wiring up Blend 3 with VB

    The InitializeComponent method is generated by the IDE when you add a Form or Window using the normal item template.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jun 2010
    Posts
    69

    Re: [RESOLVED] Wiring up Blend 3 with VB

    I resolved this thread a little prematurely. I can get everything working now except for my state groups. I'm just having my button look like it was actually pushed with some little animations, but my animations are never called or something...this is my code.

    Code Code:
    1. Class MainWindow
    2.     Inherits Window
    3.  
    4.     Public Sub New()
    5.  
    6.         ' This call is required by the Windows Form Designer.
    7.         InitializeComponent()
    8.  
    9.         ' Add any initialization after the InitializeComponent() call.
    10.  
    11.     End Sub
    12.  
    13.  
    14.  
    15.     Private Sub Window_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Window.Loaded
    16.         VisualStateManager.GoToState(Me, "Base", True)
    17.  
    18.     End Sub
    19.  
    20.  
    21.     Private Sub TestStartButton_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles TestStartButton.Click
    22.         MessageBox.Show("clicked") 'This works
    23.         VisualStateManager.GoToState(Me, "Button_Click", True)
    24.  
    25.     End Sub
    26. End Class

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width