Tuesday, March 17, 2020

VB.NET LinkLabel Component Tutorial

VB.NET LinkLabel Component Tutorial LinkLabel, new in Visual Basic .NET, is a standard control that lets you embed web-style links in a form. Like a lot of VB.NET controls, this one doesnt do anything that you couldnt do before ... but with more code and more trouble. For example, VB 6 had the Navigate (and Navigate2 when the first one proved inadequate) methods that you could use with a URL text string to call a web page. LinkLabel is much more convenient and trouble free than older techniques. But, in sync with .NET architecture, LinkLabel is designed to be used with other objects to do the whole job. You still need to use a separate command to start an email or browser for example. Example code is included below. The basic idea is to put the email address or web URL into the Text property of a LinkLabel component, then when the label is clicked, the LinkClicked event is triggered. There are well over a hundred methods and objects available for the LinkLabel object including properties to handle everything you might want to do with a link like changing the color, text, position, how it behaves when you click it ... whatever! You can even check mouse buttons and positions and test whether the Alt, Shift, or Ctrl keys are pressed when the link is clicked. A list is shown in the illustration below: Click Here to display the illustrationClick the Back button on your browser to return An object with a really long name is also passed to this event: LinkLabelLinkClickedEventArgs. Fortunately, this object is instantiated with the nice short name used for all event arguments, e. The Link object has more methods and properties. The illustration below shows the event code and the Link object. Click Here to display the illustrationClick the Back button on your browser to return You will normally use the Text property of the Link object to get a URL or email address and then pass this value to System.Diagnostics.Process.Start. To bring up a web page ... System.Diagnostics.Process.Start(http://visualbasic.about.com) To start an email using the default email program ... System.Diagnostics.Process.Start(mailto: visualbasicaboutguide.com) But youre really limited only by your imagination in using the five overloads of the Start method. You could, for example, start the Solitaire game: System.Diagnostics.Process.Start(sol.exe) If you put a file in the string field, then the default processing program for that file type in Windows will kick in and process the file. This statement will display MyPicture.jpg (if its in the root of drive C:). System.Diagnostics.Process.Start(C:MyPicture.jpg) You can use the LinkLabel almost like a button by simply putting any code you like in the LinkClicked event instead of the Start method. The investigation of the hundred or so other possibilities is wa-a-a-y beyond the scope of this article, but here are a few examples to get you started. One new concept used in LinkLabel is the idea that there can be multiple links in a LinkLabel and theyre all stored in a LinkCollection type. The first element, Links(0), in the collection is created automatically although you can control what it is using the LinkArea property of LinkLabel. In the example below, the Text property of LinkLabel1 is set to FirstLink SecondLink ThirdLink but only the first 9 characters are specified as a link. The Links collection has a Count of 1 because this link was added automatically. To add more elements to the Links collection, just use the Add method. The example also shows how ThirdLink can be added as an active part of the link. Click Here to display the illustrationClick the Back button on your browser to return Its easy to associate different targets with the different parts of the Link Text. Just set the LinkData property. To make FirstLink target the About Visual Basic web page and ThirdLink target the main About.Com web page, simply add this code to the initialization (the first two statements are repeated from the illustration above for clarity): LinkLabel1.LinkArea New LinkArea(0, 9)LinkLabel1.Links.Add(21, 9)LinkLabel1.Links(0).LinkData http://visualbasic.about.comLinkLabel1.Links(1).LinkData about.com You might want to do something like this to customize links for different users. You could use code to make one group of users go to a different target than another group. Microsoft saw the light about hyperlinks with VB.NET and included everything you might want to do with them.

Sunday, March 1, 2020

That Annoying New Verb disrespect

That Annoying New Verb disrespect That Annoying New Verb â€Å"disrespect† That Annoying New Verb â€Å"disrespect† By Maeve Maddox Reader Erica Richards, commenting on the post about the abomination â€Å"a few stuff,† was not so sanguine as I about teenagers outgrowing appalling usage: The trend Im seeing is that poor grammar habits are not only perpetuated into adulthood, but can be treated as an accepted form of speech used on TV or the radio. I suspect that eventually it is accepted as proper grammar . . . The most notable example is the current vernacular use of â€Å"disrespect† as a verb, as in he disrespected me.   Sounds like nails on a blackboard to me, however, its all over the media. Well, I feel the same way about disrespect used as a verb. It flies all over me when I hear it and I was about to write a post about how ridiculous, unidiomatic and unnecessary the usage is. Before I did, however, I looked it up in the OED. I didn’t expect to find it or, if it was there, I expected it to be labeled an Americanism. This is what I found. disrespect: v. trans. The reverse of to respect; to have or show no respect, regard, or reverence for; to treat with irreverence. Hence disreï ¿ ¼spected ppl. a., -ing vbl. n. Not only is disrespect in the OED as a verb, its use as a verb goes back to the seventeenth century. 1614 WITHER Sat. to King, Juvenilia (1633) 346 Here can I smile to see..how the mean mans suit is dis-respected. 1633 BP. HALL Hard Texts N.T. 11 If he love the one he must disrespect the other. 1683 CAVE Ecclesiastici 231 (Basil) To honor him, and dis-respect his Friend, was to stroke a mans head with one hand, and strike him with the other. 1706 HEARNE Collect. 26 Apr., He was disrespected in Oxford by several men who now speak well of him. 1852 L. HUNT Poems Pref. 27 As if..sorrow disrespected things homely. 1885 G. MEREDITH Diana I. 257 You will judge whether he disrespects me. Some of us may feel that â€Å"disrespect† as a verb is a despicable neologism, but it isn’t. Erica, your observations about the way incorrect usage filters into the media are valid, but it looks as if we’ll have to bite the bullet on disrespect as a verb. Want to improve your English in five minutes a day? Get a subscription and start receiving our writing tips and exercises daily! Keep learning! Browse the Vocabulary category, check our popular posts, or choose a related post below:20 Great Similes from Literature to Inspire You"Owing to" vs "Due to"15 Names and Descriptions of Effects

That Annoying New Verb disrespect

That Annoying New Verb disrespect That Annoying New Verb â€Å"disrespect† That Annoying New Verb â€Å"disrespect† By Maeve Maddox Reader Erica Richards, commenting on the post about the abomination â€Å"a few stuff,† was not so sanguine as I about teenagers outgrowing appalling usage: The trend Im seeing is that poor grammar habits are not only perpetuated into adulthood, but can be treated as an accepted form of speech used on TV or the radio. I suspect that eventually it is accepted as proper grammar . . . The most notable example is the current vernacular use of â€Å"disrespect† as a verb, as in he disrespected me.   Sounds like nails on a blackboard to me, however, its all over the media. Well, I feel the same way about disrespect used as a verb. It flies all over me when I hear it and I was about to write a post about how ridiculous, unidiomatic and unnecessary the usage is. Before I did, however, I looked it up in the OED. I didn’t expect to find it or, if it was there, I expected it to be labeled an Americanism. This is what I found. disrespect: v. trans. The reverse of to respect; to have or show no respect, regard, or reverence for; to treat with irreverence. Hence disreï ¿ ¼spected ppl. a., -ing vbl. n. Not only is disrespect in the OED as a verb, its use as a verb goes back to the seventeenth century. 1614 WITHER Sat. to King, Juvenilia (1633) 346 Here can I smile to see..how the mean mans suit is dis-respected. 1633 BP. HALL Hard Texts N.T. 11 If he love the one he must disrespect the other. 1683 CAVE Ecclesiastici 231 (Basil) To honor him, and dis-respect his Friend, was to stroke a mans head with one hand, and strike him with the other. 1706 HEARNE Collect. 26 Apr., He was disrespected in Oxford by several men who now speak well of him. 1852 L. HUNT Poems Pref. 27 As if..sorrow disrespected things homely. 1885 G. MEREDITH Diana I. 257 You will judge whether he disrespects me. Some of us may feel that â€Å"disrespect† as a verb is a despicable neologism, but it isn’t. Erica, your observations about the way incorrect usage filters into the media are valid, but it looks as if we’ll have to bite the bullet on disrespect as a verb. Want to improve your English in five minutes a day? Get a subscription and start receiving our writing tips and exercises daily! Keep learning! Browse the Vocabulary category, check our popular posts, or choose a related post below:20 Great Similes from Literature to Inspire You"Owing to" vs "Due to"15 Names and Descriptions of Effects

That Annoying New Verb disrespect

That Annoying New Verb disrespect That Annoying New Verb â€Å"disrespect† That Annoying New Verb â€Å"disrespect† By Maeve Maddox Reader Erica Richards, commenting on the post about the abomination â€Å"a few stuff,† was not so sanguine as I about teenagers outgrowing appalling usage: The trend Im seeing is that poor grammar habits are not only perpetuated into adulthood, but can be treated as an accepted form of speech used on TV or the radio. I suspect that eventually it is accepted as proper grammar . . . The most notable example is the current vernacular use of â€Å"disrespect† as a verb, as in he disrespected me.   Sounds like nails on a blackboard to me, however, its all over the media. Well, I feel the same way about disrespect used as a verb. It flies all over me when I hear it and I was about to write a post about how ridiculous, unidiomatic and unnecessary the usage is. Before I did, however, I looked it up in the OED. I didn’t expect to find it or, if it was there, I expected it to be labeled an Americanism. This is what I found. disrespect: v. trans. The reverse of to respect; to have or show no respect, regard, or reverence for; to treat with irreverence. Hence disreï ¿ ¼spected ppl. a., -ing vbl. n. Not only is disrespect in the OED as a verb, its use as a verb goes back to the seventeenth century. 1614 WITHER Sat. to King, Juvenilia (1633) 346 Here can I smile to see..how the mean mans suit is dis-respected. 1633 BP. HALL Hard Texts N.T. 11 If he love the one he must disrespect the other. 1683 CAVE Ecclesiastici 231 (Basil) To honor him, and dis-respect his Friend, was to stroke a mans head with one hand, and strike him with the other. 1706 HEARNE Collect. 26 Apr., He was disrespected in Oxford by several men who now speak well of him. 1852 L. HUNT Poems Pref. 27 As if..sorrow disrespected things homely. 1885 G. MEREDITH Diana I. 257 You will judge whether he disrespects me. Some of us may feel that â€Å"disrespect† as a verb is a despicable neologism, but it isn’t. Erica, your observations about the way incorrect usage filters into the media are valid, but it looks as if we’ll have to bite the bullet on disrespect as a verb. Want to improve your English in five minutes a day? Get a subscription and start receiving our writing tips and exercises daily! Keep learning! Browse the Vocabulary category, check our popular posts, or choose a related post below:20 Great Similes from Literature to Inspire You"Owing to" vs "Due to"15 Names and Descriptions of Effects