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

K

Kulber

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):
http://msdn.microsoft.com/en-us/library/bb613590.aspx


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 TextBoxBackgroundExample
Inherits Page

Private Sub OnTextBoxTextChanged(ByVal sender As Object, ByVal e As
TextChangedEventArgs)

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

End Sub

End Class
End Namespace
 
G

Gillard

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
 
K

Kulber

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.
 
G

Gillard

I use Vb8 and NO WPF


Kulber said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top