-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: SitaramanM
Message 1 in Discussion

Hi   One of the frequent problems that i face when posting Code Sample snippets in 
reply to posts is that it loses formatting.  It is such a pain to paste the code in 
the posts and then format it the way VS.Net does it.  Came across a VBColorizer class 
in the Essential ASP.Net Book, which beautifully formats a given VB Code Snippet. So 
thought i might as well write a small utility which makes use of this class and 
provides the HTML equivalent of the VB Code for pasting in User Group posts   Attached 
is a small utility which achieves this. Do note that "THE ACTUAL CLASS WHICH DOES ALL 
THE WORK IS COPIED AS-IS FROM THE ASP.NET BOOK" and i have just written the UI for the 
same.  You need to have Internet Explorer installed on the machine for the application 
to work. The utility does the following  a) Accepts a .VB File as input b) 
Alternatively you can paste the VB Code also into the VBCode Textbox c)Gives you 2 
outputs      i) HTML Code in the HTMLCode TextBox which you can use for pasting in the 
articles that you write      and      ii) The application also uses the webbrowser 
control and opens the HTML Source in the browser control, and then copies the content 
of the document to the clipboard.  So you just need to use the application , 
paste/open the VB Code Snippet and on a single button click the formatted code is 
copied onto the clipboard.  you just need to paste it in the User Group Post window 
Sample  Input VB Code Imports System.Web Public Class frmWebBrowser
    Inherits System.Windows.Forms.Form     Private Declare Sub keybd_event Lib 
"user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal 
dwExtraInfo As Long)
    'Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As 
Long)     Dim m_iCheck1 As Integer
    Dim m_bDocumentComplete As Boolean
    Dim m_bDownloadcomplete As Boolean
    Dim m_bNavigateComplete As Boolean
    Dim m_bStopSendKeys As Boolean
    Dim m_strScreenID As String
    Dim m_strLogString As String
    Dim m_strEventSinkToTrigger As String = "btn_I69AJ0720D1_AddressButton" Public 
Function fnOpenScreen()         Dim objDocument As Object
        AxWebBrowser1.Navigate2(fnGetSystemAttribute("ASPXUrl") & 
fnGetSystemAttribute("ASPXPageToOpen") & ".ASPX?" & 
fnGetSystemAttribute("QueryStringParameterName") & "=" & 
fnGetSystemAttribute("QueryStringParameterValue"))
        subWaitTillDocumentDownloads()
        m_objDocument = fnGetBrowserDocument(AxWebBrowser1)     End Function
End Class   Output HTML Source Code() <pre><html><body><Div><pre> <font 
color='blue'>Imports</font> System.Web <font color='blue'>Public</font> <font 
color='blue'>Class</font> frmWebBrowser
    <font color='blue'>Inherits</font> System.Windows.Forms.Form     <font 
color='blue'>Private</font> <font color='blue'>Declare</font> <font 
color='blue'>Sub</font> keybd_event <font color='blue'>Lib</font> "user32" (<font 
color='blue'>ByVal</font> bVk <font color='blue'>As</font> Byte, <font 
color='blue'>ByVal</font> bScan <font color='blue'>As</font> Byte, <font 
color='blue'>ByVal</font> dwFlags <font color='blue'>As</font> Long, <font 
color='blue'>ByVal</font> dwExtraInfo <font color='blue'>As</font> <font 
color='blue'>Long</font>)
    <font color='green'>'Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal 
dwMilliseconds As Long)</font>     <font color='blue'>Dim</font> m_iCheck1 <font 
color='blue'>As</font> Integer
    <font color='blue'>Dim</font> m_bDocumentComplete <font color='blue'>As</font> 
Boolean
    <font color='blue'>Dim</font> m_bDownloadcomplete <font color='blue'>As</font> 
Boolean
    <font color='blue'>Dim</font> m_bNavigateComplete <font color='blue'>As</font> 
Boolean
    <font color='blue'>Dim</font> m_bStopSendKeys <font color='blue'>As</font> Boolean
    <font color='blue'>Dim</font> m_strScreenID <font color='blue'>As</font> String
    <font color='blue'>Dim</font> m_strLogString <font color='blue'>As</font> String
    <font color='blue'>Dim</font> m_strEventSinkToTrigger <font color='blue'>As</font> 
<font color='blue'>String</font> = "btn_I69AJ0720D1_AddressButton" <font 
color='blue'>Public</font> <font color='blue'>Function</font> fnOpenScreen()         
<font color='blue'>Dim</font> objDocument <font color='blue'>As</font> Object
        AxWebBrowser1.Navigate2(fnGetSystemAttribute("ASPXUrl") & 
fnGetSystemAttribute("ASPXPageToOpen") & ".ASPX?" & 
fnGetSystemAttribute("QueryStringParameterName") & "=" & 
fnGetSystemAttribute("QueryStringParameterValue"))
        subWaitTillDocumentDownloads()
        m_objDocument = fnGetBrowserDocument(AxWebBrowser1)     <font 
color='blue'>End</font> Function
<font color='blue'>End</font> Class
</pre></div></body></html><pre>     Output HTML Content(Copied onto Clipboard) 'HTML 
File Created and Stored at location : C:\DOCUME~1\cac14543\LOCALS~1\Temp\tmp1E72.tmp  
Imports System.Web  Public Class frmWebBrowser     Inherits System.Windows.Forms.Form  
    Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As 
Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)     'Private Declare Sub Sleep 
Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)      Dim m_iCheck1 As 
Integer     Dim m_bDocumentComplete As Boolean     Dim m_bDownloadcomplete As Boolean  
   Dim m_bNavigateComplete As Boolean     Dim m_bStopSendKeys As Boolean     Dim 
m_strScreenID As String     Dim m_strLogString As String     Dim 
m_strEventSinkToTrigger As String = "btn_I69AJ0720D1_AddressButton" Public Function 
fnOpenScreen()          Dim objDocument As Object         
AxWebBrowser1.Navigate2(fnGetSystemAttribute("ASPXUrl") & 
fnGetSystemAttribute("ASPXPageToOpen") & ".ASPX?" & 
fnGetSystemAttribute("QueryStringParameterName") & "=" & 
fnGetSystemAttribute("QueryStringParameterValue"))         
subWaitTillDocumentDownloads()         m_objDocument = 
fnGetBrowserDocument(AxWebBrowser1)      End Function End Class  hth   regards,   sr
View Attachment(s):
http://groups.msn.com/BDotNet/_notifications.msnw?type=msg&parent=1&item=6144
-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to