Home | Index | Dotnet4all Snippets | Submit resources
About | Mail us 





The SqlCommand Guide (Thursday, September 28, 2006)
Dotnet4all.com has started creating a collection of miniguides that are dedicated to one single component. The first miniguide is 'The SqlCommand Guide'

Posted by Xander Zelders
0 Comments



Obtain scrollbar width. (Tuesday, January 03, 2006)

Found the following interesting discussion in the Newsgroups:

Obtain scrollbar width.
by:Keith Rebello

How do I obtain the width of a scrollbar on a Windows Forms control (eg. a
ListView control)?


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 

'SystemInformation.VerticalScrollBarWidth',
'SystemInformation.HorizontalScrollBarHeight'.

--
Herfried K. Wagner [MVP]


 Reply:
by:Armin Zingler

 

http://groups.google.com/groups?threadm=digAc.1402%24ri.114362%40dfw-read.news.verio.net

(full thread)
--
Armin



Posted by Xander Zelders
0 Comments



Mail Merge with PDF (Monday, January 02, 2006)

Found the following interesting discussion in the Newsgroups:

Mail Merge with PDF
by:Hai

Hello All,

Does any know whether we can use VB.net to merge with pdf document?

Thank you

Hai


 Reply:
by:scorpion53061

 http://www.dotnetjunkies.com/HowTo/99C3464A-2CFE-4EE5-A74D-9DEE7F6F735D.dcik

may get you started. It is ASP.NET but you may try System.IO operations
to simulate the response.write functions and see if it works.


 Reply:
by:Hai

 Thank you Scorpion
Hai



Posted by Xander Zelders
0 Comments



Socket connection in a web app?

Found the following interesting discussion in the Newsgroups:

Socket connection in a web app?
by:Martin

I am a .Net newbie. I have Visual Studio.Net 2003 and have the luxury
of being able to do some R&D/learning in a non-production environment.

I want to develop a web application that will get the data that it
serves out from two sources: (1) a database (probably MS Access but
could be SQL Server) and (2) directly from another application running
on the same machine. (BTW, this is on an intranet - the server will be
dedicated to these apps only).

I would like to have the web app and the "other" app talk to one
another using a socket connection. (The "other" app will be written in
VB6 and I'm very familiar with Winsocket communications from that
side).

I understand that there is a socket class available in .Net but that's
the limit of my knowledge. Can I use this to communicate with my
would show the use of the socket class in a web app that I could
adapt/ learn from?

Thanks for any guidance.

Martin


 Reply:
by:Cor Ligthert

 Hi Martin,

Did you already looked in the VB.net resource kit.
I thought that I had seen some samples which answers to your questions.

VB.net Resource kit
http://msdn.microsoft.com/vbasic/vbrkit/default.aspx

And if you have problems installing the resource kit
http://msdn.microsoft.com/vbasic/vbrkit/faq/#installvdir

And as advice, do not forget to look at webservice what maybe can give as
well a solution for you.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vbwlkCreatingDistributedWebApplicationWalkthrough.asp

I hope this helps?

Cor



 Reply:
by:Martin

 Yes, I have the resource kit installed. What I found in there
regarding sockets was for a Windows App. I'm assuming that using a
socket in a Web App would be different, no?


 Reply:
by:Cor Ligthert

 Hi Martin,

After this message I get maybe a better idea what you are after.
Having a connection to a userkind browser and a windows application can be
difficult, however not when you implement of course your own webbrowser,
than there are again other possibilities.

I give you two links, one is to the webbroswer the other to all ristrictions
that will be made to prevent that IE talks with a workstation. (There is
also a kind of interop possible with IE, and than you have to use shdocvw
instead of axshdocvw and because this is not a real net control probably as
well using VB6, which I do not know).

Webbrowser
http://support.microsoft.com/?kbid=311303

Some faqs
http://support.microsoft.com/default.aspx?scid=kb;EN-US;311284

mshtml
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/hosting/hosting.asp

This is what goes happen with IE without interop.

http://msdn.microsoft.com/security/default.aspx?pull=/library/en-us/dnwxp/html/xpsp2websites.asp

I hope this gives again some idea's

Cor



Posted by Xander Zelders
0 Comments



Quick Tutorial - VB6 to .NET

Found the following interesting discussion in the Newsgroups:

Quick Tutorial - VB6 to .NET
by:Liddle Feesh

Hi,

I need a quick tutorial to help me upgrade a simple client-server
application currently using ADO to VB.NET (and ADO.NET).

Does anyone have a favourite link?
--

Liddle Feesh


 Reply:
by:Dick Grier

 Hi,

I think that you will want to start with Code Advisor
(http://msdn.microsoft.com/vbasic/downloads/codeadvisor/default.asp), which
you can download from Microsoft. There are links there to tutorials, too.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.


 Reply:
by:Liddle Feesh

 
Hi Dick,

That looks superb. I'll try it out, thanks!

LF (MCP)



Posted by Xander Zelders
0 Comments



Moving between forms in VB.NET

Found the following interesting discussion in the Newsgroups:

Moving between forms in VB.NET
by:stmthoma@gapac.com (Steven Thomas)

Ok, I am a newbee at vb.net and I have written an application with
multiple forms. I have created a form named frmbase with all other
forms are inherited from. frmbase has my menu on it. I have set
frmbase as the startup form. This all works great, however when I go
to form 2 I get a new window, and I would like for it to stay in the
same window that frmBase was in so I don't have lots of windows open
as a user is working.

Can someone point in the right direction to do this?

Thanks


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 

Instead of designing forms, design usercontrols that are dynamically
instantiated/removed from the form.

--
Herfried K. Wagner [MVP]


 Reply:
by:Steven Thomas

 Sounds good but I have about 20 forms built and working. Is there not a
better way to do this? If not is there and easy way to covert my forms
to controls?

Don't just participate in USENET...get rewarded for it!


 Reply:
by:Chris Dunaway

 On Wed, 16 Jun 2004 09:26:19 -0700, Steven Thomas wrote:


One method is to open the forms inside the main form. In the main form,
add a panel to hold the other forms.

For each of the other forms, set their border style to None.

Then to load the form into the panel, do something like this (check syntax)

Private Sub LoadFormIntoPanel()
Dim MyForm2 as New Form2
MyForm2.Size = pnlContent.Size
MyForm2.TopLevel = False
MyForm2.Parent = pnlContent
MyForm2.Show
End Sub

This code will show the form inside the panel. Be sure that, as you load
and unload forms, you dispose of them properly, etc.

This should give you some ideas. I don't know if it's better, but you wont
have to change your forms.
--
Chris


 Reply:
by:stmthoma@gapac.com (Steven Thomas)

 Chris
Thanks for then info. It seems simple enough. However I got the
first form to load in the panel. Then how do I close it and load the
second. I don't seem to be able to determine which form is loaded and
how to close it?



Posted by Xander Zelders
0 Comments



Is form closed?

Found the following interesting discussion in the Newsgroups:

Is form closed?
by:Tom

Another question: Is there a way to determine if a form has been closed?
I.E. A property or something? Like an IsClosed or something similar? I have
instances where I load a new form, and in that new form I have overridden
the New constructor which may (after reading some data) decide to close the
form before it is shown. I would like to be able to tell from the caller if
that form had already been closed. I can setup my own property like
Cancelled (as a boolean) and set/check that, but was wondering if there were
a direct framework/windows forms method of determining if Me.Close had
already been called.

Thanks.

Tom


 Reply:
by:William Ryan eMVP

 
If I undertstand you correctly, I'd just add an eventhandler for that forms
closing event, and then respond to it from there. That way you know you'll
catch it and you won't have to poll for it. If you do it the way you
mention, you'll have to check each time you want to do x. INstead just use
the eventhandling model so you'll know exactly when it happens and can
respond accordingly. This willl still allow you to work in the fashion you
mention, it will just provide a lot of additional functionality.
--
W.G. Ryan, eMVP


 Reply:
by:One Handed Man \( OHM - Terry Burns \)

 Not being totally sure why you want to do this, but if you simply want the
form to not be displayed on screen or not, you could trap the close event
and do a me.hide, then cancel the close.

--


 Reply:
by:Jay B. Harlow [MVP - Outlook]

 Terry,
That would be the Closing event, as you can cancel it.

The Closed event itself is too late.

Hope this helps
Jay


 Reply:
by:One Handed Man \( OHM - Terry Burns \)

 Yes, that was a typo or mindslip, whichever you prefer

Thanks



Posted by Xander Zelders
0 Comments



Determine if property exists at runtime?

Found the following interesting discussion in the Newsgroups:

Determine if property exists at runtime?
by:Tom

Is there a clean way of determining if a propery exists in a form/class at
run time? I know I could do something like:

Try
If form/class_property=something Then
'Do exists processing
Else
'Do not exists processing
End if
Catch
End Try

But I am wondering if there is a certain property or something I can use to
check to see if another property exists.

Thanks.

Tom


 Reply:
by:One Handed Man \( OHM - Terry Burns \)

 You can do this with reflection. check this out in the Reflection namespace


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 

\\If TypeOf x Is SomeType Then
DirectCast(x, SomeType).SomeProperty = 22
End If
///

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



How to convert VB6 Type To .NET Structure

Found the following interesting discussion in the Newsgroups:

Convert VB6 Type To .NET Structure
by:Anonymous

Good Day All,

I have the following VB6 Type

Type IAListRecordType
lID As Long
strName As String * IALISTSTRSIZE
End Type

I need to convert this to VB .NET. How do I do this? I have come up with

Structure IATaskListRecordType
Dim lID As Long
Dim strName As String * IATASKLISTSTRSIZE
End Structure

However, the * IATASKLISTSTRSIZE will not compile. I get a message


Any suggestions would be appreciated. Thanks!

Dan


 Reply:
by:One Handed Man \( OHM - Terry Burns \)

 The syntax is incorrect, what are you expecting to happen with this line.?


 Reply:
by:Ken Tucker [MVP]

 Hi,

The dotnet integer is the same as the old long. Replace any longs with
integers.

Structure IATaskListRecordType
Dim lID As Integer
<VBFixedString(IATASKLISTSTRSIZE)> Dim strName As String
End Structure

Ken


 Reply:
by:Anonymous

 Ken,

Thanks for the quick response. That did the trick. I really appreciate it.

Dan



Posted by Xander Zelders
0 Comments



How to create a suimple virtual directory with default rights

Found the following interesting discussion in the Newsgroups:

Creating a suimple virtual directory with default rights
by:Microsoft

I have a web site called www.test.com

I have a folder under the wwwroot called \testfolder
How do I turn \testfolder\ into a virtual directory.

I don't need rights and settings, I've figured that part out, I just get
lost setting up the "System.DirectoryServices.DirectoryEntry" and then
executing the childern.add()


 Reply:
by:Paul Clement

 

See if the following helps:

Creating Sites and Virtual Directories Using System.DirectoryServices
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/creating_a_virtual_directory_using_system_directoryservices.asp


 Reply:
by:Mas G

 Great Thanks
but
what Does serverID in DirectoryEntry root=new
DirectoryEntry("IIS://localhost/W3SVC/" + serverID + "/Root"); mean

Its not server name again is it?


 Reply:
by:Paul Clement

 
You have to query IIS in order to determine the server instance for the default web site. Here is
some simple VB code to do this:

Function FindInstanceIDForSite() As Integer

Dim intServerID As Integer
Dim objIIS As Object

On Error Resume Next

For intServerID = 1 To 512
Set objIIS = GetObject("IIS://Localhost/w3svc/" & intServerID)
If (Err.Number <> 0) Then
FindInstanceIDForSite = intServerID
MsgBox objIIS.ServerComment
Exit Function
End If
Next

FindInstanceIDForSite = 0

End Function



Posted by Xander Zelders
0 Comments



 
Previous Posts
    - The SqlCommand Guide
    - Obtain scrollbar width.
    - Mail Merge with PDF
    - Socket connection in a web app?
    - Quick Tutorial - VB6 to .NET
    - Moving between forms in VB.NET
    - Is form closed?
    - Determine if property exists at runtime?
    - How to convert VB6 Type To .NET Structure
    - How to create a suimple virtual directory with def...

Archives
    - 10/03/2004 - 10/10/2004
    - 10/10/2004 - 10/17/2004
    - 10/17/2004 - 10/24/2004
    - 10/24/2004 - 10/31/2004
    - 10/31/2004 - 11/07/2004
    - 11/21/2004 - 11/28/2004
    - 11/28/2004 - 12/05/2004
    - 12/05/2004 - 12/12/2004
    - 12/12/2004 - 12/19/2004
    - 12/19/2004 - 12/26/2004
    - 12/26/2004 - 01/02/2005
    - 01/23/2005 - 01/30/2005
    - 01/01/2006 - 01/08/2006
    - 09/24/2006 - 10/01/2006


Disclaimer & Terms of Use | DotNet4All.Com concept & © 2004 - 2007 by Zelders² - Holland