# Quick VB 2008 question: get rid of message box

**URL:** https://boards.straightdope.com/t/quick-vb-2008-question-get-rid-of-message-box/471473
**Category:** Factual Questions
**Created:** [November 6, 2008, 4:58pm UTC](https://boards.straightdope.com/t/quick-vb-2008-question-get-rid-of-message-box/471473 "2008-11-06T16:58:24Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Roland\_Orzabal](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@Roland\_Orzabal](https://boards.straightdope.com/u/Roland_Orzabal)
#### Post date: [November 6, 2008, 4:58pm UTC](https://boards.straightdope.com/t/quick-vb-2008-question-get-rid-of-message-box/471473/1 "2008-11-06T16:58:24Z")

</div>

I’m kind of embarrassed to admit I don’t know how to do this, but…

I’m writing a little commandline app in VB Express 2008 to reconnect my machine to various network drives using _net use_. It works fine, but I want the program to execute seamlessly, which means getting rid of the message boxes saying “13176”, “8364” and the like that pop up when _net use_ completes an action. How do I programatically close these out once they appear? Basically, I’m looking for the VB equivalent of manually pressing “OK”.

If my track record in asking programming questions is any indication, I will now remember the answer in the next five minutes, :smack: myself, and return to say “never mind”. In the meantime, though, your help is appreciated!

---

<div class="post-metadata">

### Author: ![Sanity\_Challenged](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@Sanity\_Challenged](https://boards.straightdope.com/u/Sanity_Challenged)
#### Post date: [November 6, 2008, 6:20pm UTC](https://boards.straightdope.com/t/quick-vb-2008-question-get-rid-of-message-box/471473/2 "2008-11-06T18:20:07Z")

</div>

I may be missing something, as I’ve largely worked on [ASP.Net](http://ASP.Net) and not much Windows programming since .Net arrived, but I’m pretty sure there’s nothing in the .Net framework for this. You’re still going to be stuck going to the Windows API, enumerating windows to find the window handle of the dialog box you want to close, and using a SendMessage to put a mouse click into that window’s message queue. Google searches on “[vb.net](http://vb.net) sendmessage”, “[vb.net](http://vb.net) enumwindows”, and “[vb.net](http://vb.net) findwindow” seem to turn up relevant results.
