From C to VB.NET (Part III) (Background image in TextBox)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?S3VsYmVy?=

    From C to VB.NET (Part III) (Background image in TextBox)

    I feel my delay. I had work.

    First of all, thank you for reply.

    I explain: I do not know use the code of the original web page in VB.NET.
    Gillard made the translation from C (and thank you) but some things VB.NET
    does not recognize them (for example, some "imports"). I do not also know use
    the part of the code that begins for " <Page ... ", though VB.NET admits this
    code if in front of every line write three characters of commentary ( ''' ).

    If someone knows the method to realize this example in VB.NET I'll be very
    grateful and probably many people because it is a code interesting (that
    those of Microsoft might have written it also for VB).

    Thank you very much again.

    This is the code:

    Original site (in English):
    Learn how to add a placeholder to a TextBox via the included code examples in XAML, C#, and Visual Basic.



    Translation made by Gillard:

    Imports System
    Imports System.Windows
    Imports System.Windows. Input
    Imports System.Windows. Controls
    Imports System.Windows. Media
    Imports System.Windows. Media.Imaging

    Namespace SDKSample
    Partial Public Class TextBoxBackgrou ndExample
    Inherits Page

    Private Sub OnTextBoxTextCh anged(ByVal sender As Object, ByVal e As
    TextChangedEven tArgs)

    If myTextBox.Text = "" Then
    ' Create an ImageBrush.
    Dim textImageBrush As New ImageBrush()
    textImageBrush. ImageSource = New BitmapImage(New
    Uri("TextBoxBac kground.gif", UriKind.Relativ e))
    textImageBrush. AlignmentX = AlignmentX.Left
    textImageBrush. Stretch = Stretch.None
    ' Use the brush to paint the button's background.
    myTextBox.Backg round = textImageBrush
    Else
    myTextBox.Backg round = Nothing
    End If

    End Sub

    End Class
    End Namespace

  • Gillard

    #2
    Re: From C to VB.NET (Part III) (Background image in TextBox)

    1 this is not C but C#
    2 you need framework 3 'cause it is WPF
    3 you also have to copy the xaml code
    4 it look like a custom WPF library project



    "Kulber" <Kulber@discuss ions.microsoft. comwrote in message
    news:42CDCCCD-E19C-4E09-912E-6D3FBEEE391F@mi crosoft.com...
    I feel my delay. I had work.
    >
    First of all, thank you for reply.
    >
    I explain: I do not know use the code of the original web page in VB.NET.
    Gillard made the translation from C (and thank you) but some things VB.NET
    does not recognize them (for example, some "imports"). I do not also know
    use
    the part of the code that begins for " <Page ... ", though VB.NET admits
    this
    code if in front of every line write three characters of commentary (
    ''' ).
    >
    If someone knows the method to realize this example in VB.NET I'll be very
    grateful and probably many people because it is a code interesting (that
    those of Microsoft might have written it also for VB).
    >
    Thank you very much again.
    >
    This is the code:
    >
    Original site (in English):
    Learn how to add a placeholder to a TextBox via the included code examples in XAML, C#, and Visual Basic.

    >
    >
    Translation made by Gillard:
    >
    Imports System
    Imports System.Windows
    Imports System.Windows. Input
    Imports System.Windows. Controls
    Imports System.Windows. Media
    Imports System.Windows. Media.Imaging
    >
    Namespace SDKSample
    Partial Public Class TextBoxBackgrou ndExample
    Inherits Page
    >
    Private Sub OnTextBoxTextCh anged(ByVal sender As Object, ByVal e As
    TextChangedEven tArgs)
    >
    If myTextBox.Text = "" Then
    ' Create an ImageBrush.
    Dim textImageBrush As New ImageBrush()
    textImageBrush. ImageSource = New BitmapImage(New
    Uri("TextBoxBac kground.gif", UriKind.Relativ e))
    textImageBrush. AlignmentX = AlignmentX.Left
    textImageBrush. Stretch = Stretch.None
    ' Use the brush to paint the button's background.
    myTextBox.Backg round = textImageBrush
    Else
    myTextBox.Backg round = Nothing
    End If
    >
    End Sub
    >
    End Class
    End Namespace
    >

    Comment

    • =?Utf-8?B?S3VsYmVy?=

      #3
      Re: From C to VB.NET (Part III) (Background image in TextBox)

      Hello.

      I do not understand how works this of WPF, but I've created a new project to
      which I've added a WPF user control, but control Textbox not have a property
      to establish a background image. Nor does works the code example of
      Microsoft, or I don't know how to do it.

      Does any idea?

      Thank you.



      "Gillard" wrote:
      1 this is not C but C#
      2 you need framework 3 'cause it is WPF
      3 you also have to copy the xaml code
      4 it look like a custom WPF library project
      >
      >
      >
      "Kulber" <Kulber@discuss ions.microsoft. comwrote in message
      news:42CDCCCD-E19C-4E09-912E-6D3FBEEE391F@mi crosoft.com...
      I feel my delay. I had work.

      First of all, thank you for reply.

      I explain: I do not know use the code of the original web page in VB.NET.
      Gillard made the translation from C (and thank you) but some things VB.NET
      does not recognize them (for example, some "imports"). I do not also know
      use
      the part of the code that begins for " <Page ... ", though VB.NET admits
      this
      code if in front of every line write three characters of commentary (
      ''' ).

      If someone knows the method to realize this example in VB.NET I'll be very
      grateful and probably many people because it is a code interesting (that
      those of Microsoft might have written it also for VB).

      Thank you very much again.

      This is the code:

      Original site (in English):
      Learn how to add a placeholder to a TextBox via the included code examples in XAML, C#, and Visual Basic.



      Translation made by Gillard:

      Imports System
      Imports System.Windows
      Imports System.Windows. Input
      Imports System.Windows. Controls
      Imports System.Windows. Media
      Imports System.Windows. Media.Imaging

      Namespace SDKSample
      Partial Public Class TextBoxBackgrou ndExample
      Inherits Page

      Private Sub OnTextBoxTextCh anged(ByVal sender As Object, ByVal e As
      TextChangedEven tArgs)

      If myTextBox.Text = "" Then
      ' Create an ImageBrush.
      Dim textImageBrush As New ImageBrush()
      textImageBrush. ImageSource = New BitmapImage(New
      Uri("TextBoxBac kground.gif", UriKind.Relativ e))
      textImageBrush. AlignmentX = AlignmentX.Left
      textImageBrush. Stretch = Stretch.None
      ' Use the brush to paint the button's background.
      myTextBox.Backg round = textImageBrush
      Else
      myTextBox.Backg round = Nothing
      End If

      End Sub

      End Class
      End Namespace
      >

      Comment

      • Gillard

        #4
        Re: From C to VB.NET (Part III) (Background image in TextBox)

        I use Vb8 and NO WPF


        "Kulber" <Kulber@discuss ions.microsoft. comwrote in message
        news:5A64BDFA-DAB8-46AF-AF90-8E3BA5EC8E3E@mi crosoft.com...
        Hello.
        >
        I do not understand how works this of WPF, but I've created a new project
        to
        which I've added a WPF user control, but control Textbox not have a
        property
        to establish a background image. Nor does works the code example of
        Microsoft, or I don't know how to do it.
        >
        Does any idea?
        >
        Thank you.
        >
        >
        >
        "Gillard" wrote:
        >
        >1 this is not C but C#
        >2 you need framework 3 'cause it is WPF
        >3 you also have to copy the xaml code
        >4 it look like a custom WPF library project
        >>
        >>
        >>
        >"Kulber" <Kulber@discuss ions.microsoft. comwrote in message
        >news:42CDCCC D-E19C-4E09-912E-6D3FBEEE391F@mi crosoft.com...
        I feel my delay. I had work.
        >
        First of all, thank you for reply.
        >
        I explain: I do not know use the code of the original web page in
        VB.NET.
        Gillard made the translation from C (and thank you) but some things
        VB.NET
        does not recognize them (for example, some "imports"). I do not also
        know
        use
        the part of the code that begins for " <Page ... ", though VB.NET
        admits
        this
        code if in front of every line write three characters of commentary (
        ''' ).
        >
        If someone knows the method to realize this example in VB.NET I'll be
        very
        grateful and probably many people because it is a code interesting
        (that
        those of Microsoft might have written it also for VB).
        >
        Thank you very much again.
        >
        This is the code:
        >
        Original site (in English):
        Learn how to add a placeholder to a TextBox via the included code examples in XAML, C#, and Visual Basic.

        >
        >
        Translation made by Gillard:
        >
        Imports System
        Imports System.Windows
        Imports System.Windows. Input
        Imports System.Windows. Controls
        Imports System.Windows. Media
        Imports System.Windows. Media.Imaging
        >
        Namespace SDKSample
        Partial Public Class TextBoxBackgrou ndExample
        Inherits Page
        >
        Private Sub OnTextBoxTextCh anged(ByVal sender As Object, ByVal e
        As
        TextChangedEven tArgs)
        >
        If myTextBox.Text = "" Then
        ' Create an ImageBrush.
        Dim textImageBrush As New ImageBrush()
        textImageBrush. ImageSource = New BitmapImage(New
        Uri("TextBoxBac kground.gif", UriKind.Relativ e))
        textImageBrush. AlignmentX = AlignmentX.Left
        textImageBrush. Stretch = Stretch.None
        ' Use the brush to paint the button's background.
        myTextBox.Backg round = textImageBrush
        Else
        myTextBox.Backg round = Nothing
        End If
        >
        End Sub
        >
        End Class
        End Namespace
        >
        >>

        Comment

        • =?Utf-8?B?S3VsYmVy?=

          #5
          Re: From C to VB.NET (Part III) (Background image in TextBox)

          I also use vb8. Why do you say that?

          "Gillard" wrote:
          I use Vb8 and NO WPF
          >
          >
          "Kulber" <Kulber@discuss ions.microsoft. comwrote in message
          news:5A64BDFA-DAB8-46AF-AF90-8E3BA5EC8E3E@mi crosoft.com...
          Hello.

          I do not understand how works this of WPF, but I've created a new project
          to
          which I've added a WPF user control, but control Textbox not have a
          property
          to establish a background image. Nor does works the code example of
          Microsoft, or I don't know how to do it.

          Does any idea?

          Thank you.



          "Gillard" wrote:
          1 this is not C but C#
          2 you need framework 3 'cause it is WPF
          3 you also have to copy the xaml code
          4 it look like a custom WPF library project
          >
          >
          >
          "Kulber" <Kulber@discuss ions.microsoft. comwrote in message
          news:42CDCCCD-E19C-4E09-912E-6D3FBEEE391F@mi crosoft.com...
          I feel my delay. I had work.

          First of all, thank you for reply.

          I explain: I do not know use the code of the original web page in
          VB.NET.
          Gillard made the translation from C (and thank you) but some things
          VB.NET
          does not recognize them (for example, some "imports"). I do not also
          know
          use
          the part of the code that begins for " <Page ... ", though VB.NET
          admits
          this
          code if in front of every line write three characters of commentary (
          ''' ).

          If someone knows the method to realize this example in VB.NET I'll be
          very
          grateful and probably many people because it is a code interesting
          (that
          those of Microsoft might have written it also for VB).

          Thank you very much again.

          This is the code:

          Original site (in English):
          Learn how to add a placeholder to a TextBox via the included code examples in XAML, C#, and Visual Basic.



          Translation made by Gillard:

          Imports System
          Imports System.Windows
          Imports System.Windows. Input
          Imports System.Windows. Controls
          Imports System.Windows. Media
          Imports System.Windows. Media.Imaging

          Namespace SDKSample
          Partial Public Class TextBoxBackgrou ndExample
          Inherits Page

          Private Sub OnTextBoxTextCh anged(ByVal sender As Object, ByVal e
          As
          TextChangedEven tArgs)

          If myTextBox.Text = "" Then
          ' Create an ImageBrush.
          Dim textImageBrush As New ImageBrush()
          textImageBrush. ImageSource = New BitmapImage(New
          Uri("TextBoxBac kground.gif", UriKind.Relativ e))
          textImageBrush. AlignmentX = AlignmentX.Left
          textImageBrush. Stretch = Stretch.None
          ' Use the brush to paint the button's background.
          myTextBox.Backg round = textImageBrush
          Else
          myTextBox.Backg round = Nothing
          End If

          End Sub

          End Class
          End Namespace

          >
          >

          Comment

          • Gillard

            #6
            Re: From C to VB.NET (Part III) (Background image in TextBox)

            because to make a WPF project you need some more stuff than just vb2005

            "Kulber" <Kulber@discuss ions.microsoft. comwrote in message
            news:0624C692-956D-4960-B6F3-94DFE38AD4CF@mi crosoft.com...
            I also use vb8. Why do you say that?
            >
            "Gillard" wrote:
            >
            >I use Vb8 and NO WPF
            >>
            >>
            >"Kulber" <Kulber@discuss ions.microsoft. comwrote in message
            >news:5A64BDF A-DAB8-46AF-AF90-8E3BA5EC8E3E@mi crosoft.com...
            Hello.
            >
            I do not understand how works this of WPF, but I've created a new
            project
            to
            which I've added a WPF user control, but control Textbox not have a
            property
            to establish a background image. Nor does works the code example of
            Microsoft, or I don't know how to do it.
            >
            Does any idea?
            >
            Thank you.
            >
            >
            >
            "Gillard" wrote:
            >
            >1 this is not C but C#
            >2 you need framework 3 'cause it is WPF
            >3 you also have to copy the xaml code
            >4 it look like a custom WPF library project
            >>
            >>
            >>
            >"Kulber" <Kulber@discuss ions.microsoft. comwrote in message
            >news:42CDCCC D-E19C-4E09-912E-6D3FBEEE391F@mi crosoft.com...
            I feel my delay. I had work.
            >
            First of all, thank you for reply.
            >
            I explain: I do not know use the code of the original web page in
            VB.NET.
            Gillard made the translation from C (and thank you) but some things
            VB.NET
            does not recognize them (for example, some "imports"). I do not also
            know
            use
            the part of the code that begins for " <Page ... ", though VB.NET
            admits
            this
            code if in front of every line write three characters of commentary
            (
            ''' ).
            >
            If someone knows the method to realize this example in VB.NET I'll
            be
            very
            grateful and probably many people because it is a code interesting
            (that
            those of Microsoft might have written it also for VB).
            >
            Thank you very much again.
            >
            This is the code:
            >
            Original site (in English):
            Learn how to add a placeholder to a TextBox via the included code examples in XAML, C#, and Visual Basic.

            >
            >
            Translation made by Gillard:
            >
            Imports System
            Imports System.Windows
            Imports System.Windows. Input
            Imports System.Windows. Controls
            Imports System.Windows. Media
            Imports System.Windows. Media.Imaging
            >
            Namespace SDKSample
            Partial Public Class TextBoxBackgrou ndExample
            Inherits Page
            >
            Private Sub OnTextBoxTextCh anged(ByVal sender As Object,
            ByVal e
            As
            TextChangedEven tArgs)
            >
            If myTextBox.Text = "" Then
            ' Create an ImageBrush.
            Dim textImageBrush As New ImageBrush()
            textImageBrush. ImageSource = New BitmapImage(New
            Uri("TextBoxBac kground.gif", UriKind.Relativ e))
            textImageBrush. AlignmentX = AlignmentX.Left
            textImageBrush. Stretch = Stretch.None
            ' Use the brush to paint the button's background.
            myTextBox.Backg round = textImageBrush
            Else
            myTextBox.Backg round = Nothing
            End If
            >
            End Sub
            >
            End Class
            End Namespace
            >
            >>
            >>

            Comment

            Working...