Fred Mastropasqua's Facebook profile

Convert Hex Color to System.Drawing.Color in VB.Net

by Fred Mastro 27. March 2009 02:03

Here's a simple one....

tcStatusColor.BackColor = System.Drawing.ColorTranslator.FromHtml("#4f81db")

Tags: , , ,

Code Snippets | VB.NET

Merging DataTables

by Fred Mastro 25. March 2009 02:02
   1: Public Sub MergeDataTables(source as DataTable, destination As DataTable)   
   2:   destination.BeginLoadData()   
   3:  
   4:   For i As Integer=0 To source.Rows.Count - 1
   5:     destination.LoadDataRow(source.Rows(i).ItemArray,True)
   6:   Next
   7:  
   8:   destination.EndLoadData()  
   9: End Sub

Reference: by All-Star at http://forums.asp.net/p/1075389/1578419.aspx

Tags: , ,

Programming | VB.NET

Setting Focus in ASP.Net

by Fred Mastro 24. March 2009 02:01

Found a great article on setting focus without using Javascript and being able to do it, programmically.

ASP.NET 2.0 simplified this problem and introduce a concept of "default focus". There is a new DefaultFocus attribute that allows you to easily set focus to desired controls. The sample HTML code bellow will set focus on control named textbox1:

<form id="Form1" defaultfocus="textbox" runat="server">
  <asp:textbox id="textbox1" runat="server"/>
  <asp:textbox id="textbox2" runat="server"/>
  <asp:button id="button1" text="Button1" runat="server"/>
</form>

ASP.NET 2.0 provides three different new solutions if you need to set focus dynamically. At run time you can use Page.SetFocus method with control's ID as a parameter or you can simply call a new control's Focus method. They both do practically the same thing. It is only programmer's choice to choose which method likes more.

There is also DefaultFocus property of the form element. Set this property to ID of wanted control, run the project and that control will get focus when page is first time loaded.

   1: pnlLookupDetail.Visible = True
   2: Page.SetFocus(txtLookupDescription)

The Full Article can be found here, http://www.beansoftware.com/asp.net-tutorials/focus-asp.net.aspx

Tags: , , ,

ASP.NET | Code Snippets

Stripping all HTML Characters using VB.Net

by Fred Mastro 23. March 2009 02:00

This is actually pretty easy and I had needed to use it on a page where I wanted to use a ToolTip of the contents of an editor which stored the HTML of the content...

Using Regular Expression we can strip off the HTML tags.

   1: Dim ContentDataStrippedOfHTML As StringContentDataStrippedOfHTML = Regex.Replace(SourceOriginalDataStringHere, "<(.|\n)*?>", String.Empty) 
   2:  

Right to the point.

Tags:

VB.NET

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

A Certified MCSE (NT4 & 2k), MCDBA (2k), A+, CCA, with over 10 years of experience with Windows Networking and Development. Developing mainly in ASP.NET, VB.NET and T-SQL. Also develops in Objective-C (iPhone), XAML (SilverLight & WPF), C#, "Classic" ASP 3.0, ADSI,  VBscript, WScript.

Non-technical hobbies include other areas such as Movie watching (action, epic, comedy, some romantic comedy, well everything), Reading (Science Fiction, Fantasy, Detective and Programming categories), Film Editing, Directing with Special effects (using Adobe Premiere and Adobe After Effects), Dungeons & Dragons (D&D 4th Edition), Auto-Cross Racing & Cars (BMW M3, MazdaSpeed's), Motorcycles (Honda CBR 600), TV Shows (Flight of the Conchords, Lie To Me, DollhouseBattleStar Galatica, Smallville, Alias), Music (Akon, Billy Joel, Micheal Bublé, Bid Daddy Weave, T-Pain, Barlow Girl, Notorious B.I.G and more, love all types of music), and Religion (Christianity, debating and prophecies).


Web Tools - QuickLinks

Web tools I use more then others. Some of these are on my Link Collections page, but this made it easier for me to go to my site and click a tool.

  1. Telerik Code Converter (C# to VB/VB to C#)
  2. Lorem Ipsum - Dummy Text for Prototype Apps
  3. Web Color Values
  4. Open Source Icons

 

Highlights

  • Some websites I've worked on. This is a small collection of sites I've developed or added to awhile back.

  • Revenge Movie Trailer. Trailer I made with Adobe Premiere and After Effects. Jason Christman is the main star and I'm the director behind the camera.

  • Essential Software For your Mac. - I'm a Microsoft geek, but I've switched over to Mac. There was a lot of stuff I needed to get installed that I missed on my Windows machine. Also I had no idea how to do it :p Here's some help.

  • Speed Football. I wanted to make a special effect like the Smallville or Superman running fast. All the other ones I've seen, the person in the frame was the only moving object while everything else was blurred. I wanted to create the effect but interact with another normal moving object.
  •    
  • Code Snippets and Quickies. Sometims I find something or develop something that I think is useful and it can be copied and pasted anywhere for someone to use. Here's a collection of things I've posted on.
  • Books I've Read or Reading