473,785 Members | 2,879 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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):
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 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

Aug 16 '08 #1
5 3926
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" <Ku****@discuss ions.microsoft. comwrote in message
news:42******** *************** ***********@mic rosoft.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):
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 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
Aug 16 '08 #2
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" <Ku****@discuss ions.microsoft. comwrote in message
news:42******** *************** ***********@mic rosoft.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):
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 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
Aug 17 '08 #3
I use Vb8 and NO WPF
"Kulber" <Ku****@discuss ions.microsoft. comwrote in message
news:5A******** *************** ***********@mic rosoft.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" <Ku****@discuss ions.microsoft. comwrote in message
news:42******* *************** ************@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):
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 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
Aug 17 '08 #4
I also use vb8. Why do you say that?

"Gillard" wrote:
I use Vb8 and NO WPF
"Kulber" <Ku****@discuss ions.microsoft. comwrote in message
news:5A******** *************** ***********@mic rosoft.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" <Ku****@discuss ions.microsoft. comwrote in message
news:42******** *************** ***********@mic rosoft.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):
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 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

Aug 17 '08 #5
because to make a WPF project you need some more stuff than just vb2005

"Kulber" <Ku****@discuss ions.microsoft. comwrote in message
news:06******** *************** ***********@mic rosoft.com...
I also use vb8. Why do you say that?

"Gillard" wrote:
>I use Vb8 and NO WPF
"Kulber" <Ku****@discuss ions.microsoft. comwrote in message
news:5A******* *************** ************@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" <Ku****@discuss ions.microsoft. comwrote in message
news:42******* *************** ************@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):
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 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

Aug 17 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5352
by: erik | last post by:
Is it posssible to inherit the previous pages (parent pages) background image? Is there a script out there I could look at? Thanks
1
7288
by: Robert Skidmore | last post by:
I am building an application that will fade one panel to another panel. Both panels will have picture boxes in them (thumbnails). This is what I have tried: private void fade(System.Windows.Forms.Panel fP){ for (int i = 255; i >= 0;i--){ System.Threading.Thread.Sleep(10); fP.BackColor = System.Drawing.Color.FromArgb(i, 255,255,255); System.Windows.Forms.Application.DoEvents();
0
2180
by: Anonieko Ramos | last post by:
> I have a graphics images that I want to convert to > ASCII art. How do I do it? > Code: - Default.aspx.cs
1
1381
by: Daniel | last post by:
when i set the BackgroundImage property in the designer the image still doesnt show in the background of the textbox any other property must be set?
19
10239
by: Steve Franks | last post by:
I am using VS.NET 2005 beta 2. When I run my project locally using the default ASP.NET Development Web Server it runs using a root address like this: http://localhost:11243/testsite/ However when I deploy to a remote test server running real IIS, the real root of my application becomes: http://localhost/ What I want to do is have it so that on my local machine the asp.net dev
12
2452
by: Dudely | last post by:
I want to be a good little author and use CSS. Therefore, I'm attempting to convert my tables to the equivalent CSS. Unfortunately, I can't reproduce the same results. Can someone take a look at http://www.greengoldcapital.info/test/test.shtml and see if you can tell me what I'm doing wrong? What you see there is of course a mess at this point, as I've tried numerous ways to get this done and left most of those trials intact in
14
3149
by: Stapes | last post by:
Hi I have this entry in my stylesheet main1.css: #head { width: 310px; height: 60px; float: left; display: block; background-image: url(logo.jpg); background-position: left top;
4
13473
by: =?Utf-8?B?S3VsYmVy?= | last post by:
First off, excuse my English, is an online translation. Hello. I've been looking for a long time over the Internet how to make a "textbox" is transparent or having a background image, but I can not find, just a website that allows a "textbox" is transaprente, but is in C (and not I have no idea C). The Web is this: http://www.codeproject.com/KB/edit/TransparentTextBox.aspx I think that is an interesting feature that microsoft has not...
0
1214
by: Nomen Nescio | last post by:
SQLITE Blob writing error wizard said: Yeah, no problem. We love SQLITE around here. You may need to include the header for unlink(). On a POSIX system, this would be unistd.h.
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10329
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.