How to make a part of a label bold - vb.net

I want to make bold just the "name" in the string, how to do it?
Dim name As String = Environment.UserName
LabelWelcome.Text = "Welcome " + name + ", ...!"

I don't believe this is do-able on default labels since there is no style formatting.
I suggest to use 2 labels or a rich text box control.

You can use two labels and put them side by side. One having the bold part and other having the simple text.
You can use the OnPaint() method for custom drawing also

I found this : http://pastebin.com/L4xScMjZ [Not made by me]
It's a class that highlights part of a label for you. It doesn't bold it, but you can highlight the important part in red or any color you want.
I'm sure you could turn this to make the highlighted part bold as well.
To use it, you create a new class and put that code in.
Build your project and there should be a new control called "Scrolling Label"
You can add that control to your project and edit the properties :
Highlight : # --> how many characters you want it to highlight from left to right
HighLightText --> The color of the highlighted text
This is a bit buggy so you might want to add "DoubleBuffer = True" in your form Load

For those who still Google this: You can make a function which replaces your characters with some unicodes. You can use most of WorksheetFunction.Unichar(119808) to WorksheetFunction.Unichar(120831)

Related

Changing Label's Image According To Variable?

I'm trying to make (using Visual Basic) a rudimentary questionnaire that measures multiple attributes and stores their values in an array and afterwards measures the attributes on a scale of 1 to 10.Now I've had the dumb idea to use a label for every single value of every attribute, and highlighting the right number by changing the label's image to yellow, instead of white(basically making the area behind the number a different color).
Now here's the issue: I can't seem to find out how to change a label's background image with code, which is what I'm asking. (I'm guessing the command should look something like "Label1.image = >image path<")
Pretty simple.
If text = No then
Label.Text = No
Else
Label.Text = Yes
End IF
You just have to change the text value of the label which is .Text = Text you want
And if your trying to show images, you should use the image control in the tool box, not a label

Which text field should I use in word and how to fill it

I am trying to use a text field in my word template document but I confused which one should I use?!!
which one you recommend?
Rick text
Text
Text Form Field
My second question is how to address these component in Macro? I use below code:
ActiveDocument.FormFields("TextboxName")
Third question is how to set a value to this component in Macro? so many website use .Value but I don't know why I cannot find this field in above component.
Last question is: if I use any form field, a gray shadow exist below my component, how I can remove it? it is even coming in check print.:(
I am using word 2007.
You would add : textFormField.
you would pass value by Me.FormFields("Text1").Result = "abc"
in your controls tab,
somewhere next to the formField control find the "formFieldShadding"
control. when you select that control your gray shadding will
disappear.

VB.NET add text to the front of text

I am trying to add text to current text that is in a textbox using a checkbox. Once the checkbox is checked, it will "add" the text to the textbox before the text already in the textbox.
example:
if the textbox said "Jake", it would say "Hello Jake" once the checkbox was checked.
EDIT: sorry for the quick question. I'm in a hurry. But the only method I could think of was concatenating and appending text. As far as I know append() adds only to the end, and concatening isn't the logical approach. I don't have a coded example because I dont even know how to approach this issue. thanks.
It's getting a thumbs down because its so simple, but not. I'm using multiple checkboxes. So one needs to be in the very front, one in the center, etc. Each checkbox injects text into the textbox a certain way. I can do this with nested if statements, but then we got a mess.
Try using this code :
if chbHello.Checked then
txtName.Text = chbHello.Text + " " + txtName.Text
Note : if the checkbox is the trigger put this code in the checkbox.
All it does is see if the checkbox was checked or not.
When its checked just concatenate the text of the textbox and the checkbox with the
checkbox first.

Make a spell checker

I am a newbie to VB.Net. Before, I did programming in PHP. I made a spell checker in PHP which splitted a big string into single word by spaces, checked if the word is there in the dictionary, if not, it highlighted it and gave some suggestions when a user clicks on it. I want to make the same thing in VB.Net... Any ideas??
Thanks.
make use of a Dictionnary(Of String, String) for your dictionnary. ;
To split the string, you have the Split function (" ,;.") ;
define ExtWord, a class holding the word, a boolean stating if in or not the dictionnary,
and the proposed corrections.
Then you have a list of ExtWord that you bind to a ListView, the
listview having a Horizontal WrapPanel as ItemsPanel.
Set the background color of TextBlock depending if inside the Dictionnary or not .
Then handle the right click on a TextBlock, and can build a ContextMenu in code and add the correct words inside it in code, then show it.
Only problem i see is how to do the 'carriage return' with
the WrapPanel.
Hopes it helps to get to your solution.
Try below link for spell checker in vb.net
http://www.a1vbcode.com/app-3641.asp
http://www.codeproject.com/Articles/265823/i00-VB-NET-Spell-Check-No-3rd-Party-Components-Req

Checkboxes in Rdlc Report

I am creating rdlc report and i have issue that i got some bool type object fields and now i have to show checkboxes. but there is nothing i found for this solution to show checkboxes in table.
Is there anyone who know that how i can implement that thing?
Maybe you can put image there, depend on true or false, just display different pic. LOL
If checkbox is true I set Chr(254) else show unchecked checkbox using Chr(168).
Chr(254): This is decimal value for Wingdings character 254 its shows like checked check box image.
Chr(168): This is decimal value for Wingdings character 168 its shows like rectangle box like unchecked check box image.
I had a requirement that the checkboxes have a background color. I liked the simplicity of a text-based rather than image-based approach, so I used a variation of the popular Wingdings-font method: I used a small, square textbox with a thin border and the specified background color, set it to use a bold, sans-serif font, and used this expression for the text value:
=IIf(Fields!SomeBool.Value, "X", "")
If you still want a checkmark rather than an X, you can use Wingdings 2 font and this expression:
=IIf(Fields!SomeBool.Value, Chr(80), "")
In either case, you may have to adjust the font size and/or box size to keep the result square; my first take was taller than wide because it expanded vertically to accommodate the font.
Or you can set the textbox placeholder to render tags as html and then put this html in: Or you can set the Placeholder expression to support HTML and then set up the following html code:
<font face="Wingdings 2" color="green">#Html.Raw(((char)0x51).ToString())</font>
You should put in the character of the wingdings that you want.
This way, only part of the text can be wingdings.
Wingdings 2
Finally I got solution
here is the link download the project and run it.
http://uploading.com/files/2mmf34m8/Nestle%2BNew.rar/
i have developed class and then used list to set bool variable true/false. while on other hand i used image control in rdlc report To set image.
You just need to set image path which are already in image folder.
Cheers.