Results 1 to 11 of 11

Thread: How to write a welcome note in the main page?

  1. #1

    Thread Starter
    Member
    Join Date
    May 2008
    Posts
    46

    Wink How to write a welcome note in the main page?

    Hello, My question is, after logging in, i've reached the main page. Then i would like a messageBox to pop out saying that "You have entered *this* page". It has to pop out as soon as I enter the page. Please help as time is not on my side. Thanks a lot.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: How to write a welcome note in the main page?

    What is this? A webapp in asp.net or a desktop app with Winforms?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Member
    Join Date
    May 2008
    Posts
    46

    Re: How to write a welcome note in the main page?

    A webapp in asp.net using vb.net.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: How to write a welcome note in the main page?

    Ok, I can move this thread to the proper forum then.

    Codebank is for finished tips and tricks etc.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,173

    Re: How to write a welcome note in the main page?

    Add some javascript to the page.

    <script type="text/JavaScript">
    alert('Hello, welcome to this page.');
    </script>

    You can also use ClientScript.RegisterStartupScript() to output javascript to the page.

  6. #6

    Thread Starter
    Member
    Join Date
    May 2008
    Posts
    46

    Wink Re: How to write a welcome note in the main page?

    Can we use these scripts in the webapplication? where do I insert this codes? I'm quite lost here. Can't we write it in vb.net format?
    Thanks.

  7. #7
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Re: How to write a welcome note in the main page?

    Can't we write it in vb.net format?
    Nope, what you have to think of is that, within an Internet/Intranet application, the webserver simply serves up and posts web pages it has, when users request the pages. Those pages are then disconnected and have no more to do with the server at all - they're simply rendered within the user's browser.

    So writing server side code to bring up an operating system messagebox isn't available, all you have is the ability of throwing up a browser alert box via the use of a client side scripting language, such as Javascript.

    Where do I insert this codes? I'm quite lost here.
    Well assuming you want to show this alert when the page is first displayed to the user, then you can place the above code within the HTML, like so:
    Code:
    <html>
    <head>
      <script language="javascript">
    
        function ShowMeTheMessage() {
          alert('Hello world!');
        }
    
      </script>
    </head>
    <body onLoad="javascript: ShowMeTheMessage();">
    </body>
    </html>

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  8. #8

    Thread Starter
    Member
    Join Date
    May 2008
    Posts
    46

    Re: How to write a welcome note in the main page?

    Ok. But how do I convert these codes into the vb.net format? Like which part do I write these codes? the showmethemessage box, will i have to change it to MsgBox("Hello world")? Is it like that? Please explain and show me. Thanks.

  9. #9
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Smile Re: How to write a welcome note in the main page?

    Again you can't really use VB.Net here, you need to use a client scripting language such as VBScript or JavaScript. As JavaScript is supported on more browsers, I've opted to write the sample in that above. You'd be able to see looking at that where I've written the wording "hello world" in it's this part (it doesn't really matter if you use single or double quotes to surround the string in Javascript):
    Code:
    alert('Hello world!');
    Basically these 2 are the same thing, top in Javascript, 2nd in VBNet
    Code:
    function ShowMeTheMessage() { 
    }
    
    Private Function ShowMeTheMessage
    End Function
    and these 2 are the same:
    Code:
    alert('Hello world!');
    
    Messagebox.Show("Hello world!")
    Last edited by alex_read; May 29th, 2008 at 07:23 AM.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  10. #10

    Thread Starter
    Member
    Join Date
    May 2008
    Posts
    46

    Re: How to write a welcome note in the main page?

    Oh ok. Thanks a lot. I'll try that. Thanks again. Been a great help. :P

  11. #11
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,173

    Re: How to write a welcome note in the main page?

    vb Code:
    1. Public Sub ShowTheMessage(theMessage As String)
    2.  
    3. ClientScript.RegisterStartupScript(Me.GetType(), "MyAlert", "<script type='text/javascript'>alert('" & theMessage & "');</script>")
    4.  
    5. End Sub


    That's how you'd do it from your codebehind to dynamically generate an alert box with your message in it. You can call it from any event such as Page Load, a Button Click and so on.

    ShowTheMessage("Hello World")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width