By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,784 Members | 3,582 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,784 IT Pros & Developers. It's quick & easy.

Project Items - What's the purpose?

P: n/a
Can anyone tell me what the purpose is to adding items such as a
VBScript file or HTML document to your VB.NET project? Once you have
these things added, how to you access them and use them in your code?
Nov 20 '05 #1
Share this Question
Share on Google+
14 Replies


P: n/a
* copyco <co****@anon.com> scripsit:
Can anyone tell me what the purpose is to adding items such as a
VBScript file or HTML document to your VB.NET project? Once you have
these things added, how to you access them and use them in your code?


What exactly do you want to do with the files?

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!
Nov 20 '05 #2

P: n/a
copyco,
Can anyone tell me what the purpose is to adding items such as a
VBScript file or HTML document to your VB.NET project? These files are commonly used in ASP.NET (web projects).

I will use an HTML document in Windows Forms projects to contain
documentation and/or readme files.

Having them in a Windows Forms project is also useful if your Windows Forms
project relies on the Web Browser control for its primary interface...

I'm sure there are other uses for them (read as "think out side the box").
Once you have
these things added, how to you access them and use them in your code? Really depends on why you added them. (web project, documentation, Web
Browser UI, other).

Hope this helps
Jay
"copyco" <co****@anon.com> wrote in message
news:%e******************@newssvr24.news.prodigy.c om... Can anyone tell me what the purpose is to adding items such as a
VBScript file or HTML document to your VB.NET project? Once you have
these things added, how to you access them and use them in your code?

Nov 20 '05 #3

P: n/a
Cor
Hi Copyco,

As an addition to Herfried,

You can add everything to a Vb.net project.
movies, pictures, html.documents, xmldatasets.

If you are not intended to use them you can better not do that, it uses only
space.

Just my thought.

Cor
Can anyone tell me what the purpose is to adding items such as a
VBScript file or HTML document to your VB.NET project? Once you have
these things added, how to you access them and use them in your code?

Nov 20 '05 #4

P: n/a


Herfried K. Wagner [MVP] wrote:
* copyco <co****@anon.com> scripsit:
Can anyone tell me what the purpose is to adding items such as a
VBScript file or HTML document to your VB.NET project? Once you have
these things added, how to you access them and use them in your code?

What exactly do you want to do with the files?

Well, I was thinking I might be able to dynamically edit the html
document and then export it. Or with the VBScript, pass some parameters
to it from my WinForm code and execute it. Is this possible? Or does
the VBScript have to be external to the project?
Nov 20 '05 #5

P: n/a
* copyco <co****@anon.com> scripsit:
Well, I was thinking I might be able to dynamically edit the html
document and then export it. Or with the VBScript, pass some
parameters to it from my WinForm code and execute it. Is this
possible? Or does the VBScript have to be external to the project?


You can add it to the project, but in the output it must still remain a
separate file (not embedded into the application's binary).

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!
Nov 20 '05 #6

P: n/a
This is not new to VS2003. We added .doc files to VB6 project to ensure
that all information about a project was kept as one entity. Using this
allowed these documents to be under source control (better than relying on
people to do it themselves). A get latest version of the project would get
all info. This is the same for any type of file.

Think of it as simply a method to organize the data needed to create an
application. Even if the file is not compiled (as a .doc or .bmp/jpg would
be), those files travel with the project/solution.

Lloyd Sheen

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ee**************@TK2MSFTNGP12.phx.gbl...
* copyco <co****@anon.com> scripsit:
Can anyone tell me what the purpose is to adding items such as a
VBScript file or HTML document to your VB.NET project? Once you have
these things added, how to you access them and use them in your code?


What exactly do you want to do with the files?

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!

Nov 20 '05 #7

P: n/a
copyco,
Well, I was thinking I might be able to dynamically edit the html
document and then export it. Explain "export it", HTML added to a project is going to be "external" to
the binary, which means you will need to add it to your setup project to
have it deployed. Alternatively you can set the "Build Action" to "Embedded
Resource" to have the HTML file embedded into your executable, which means
you may then need to "export it" to a file, to actually use it. The Build
Action is available from the properties window when you select the file in
Solution Explorer. You can use a ResourceManager and/or ResourceReader to
get at the embedded file in your executable.
Or with the VBScript, pass some parameters
to it from my WinForm code and execute it. Is this possible? You could use either the COM Script control, or Process.Start to exectu
Or does
the VBScript have to be external to the project? You could have the VBScript embedded in the executable like you can an HTML
file.

Hope this helps
Jay

"copyco" <co****@anon.com> wrote in message
news:5h**********************@newssvr11.news.prodi gy.com...

Herfried K. Wagner [MVP] wrote:
* copyco <co****@anon.com> scripsit:
Can anyone tell me what the purpose is to adding items such as a
VBScript file or HTML document to your VB.NET project? Once you have
these things added, how to you access them and use them in your code?

What exactly do you want to do with the files?

Well, I was thinking I might be able to dynamically edit the html
document and then export it. Or with the VBScript, pass some parameters
to it from my WinForm code and execute it. Is this possible? Or does
the VBScript have to be external to the project?

Nov 20 '05 #8

P: n/a
Cor
Hi Copyco,

I think that I start to understand what is the basis of your question

With the VS.studio IDE you can make perfect classic HTML websites.

Therefore you need things as javascript, css, vbscript and of course HTML
files.

Cor
Nov 20 '05 #9

P: n/a


Jay B. Harlow [MVP - Outlook] wrote:
copyco,
Well, I was thinking I might be able to dynamically edit the html
document and then export it.


Explain "export it", HTML added to a project is going to be "external" to
the binary, which means you will need to add it to your setup project to
have it deployed. Alternatively you can set the "Build Action" to "Embedded
Resource" to have the HTML file embedded into your executable, which means
you may then need to "export it" to a file, to actually use it. The Build
Action is available from the properties window when you select the file in
Solution Explorer. You can use a ResourceManager and/or ResourceReader to
get at the embedded file in your executable.

Or with the VBScript, pass some parameters
to it from my WinForm code and execute it. Is this possible?


You could use either the COM Script control, or Process.Start to exectu

Or does
the VBScript have to be external to the project?


You could have the VBScript embedded in the executable like you can an HTML
file.

Hope this helps
Jay

"copyco" <co****@anon.com> wrote in message
news:5h**********************@newssvr11.news.prodi gy.com...

Herfried K. Wagner [MVP] wrote:

* copyco <co****@anon.com> scripsit:
Can anyone tell me what the purpose is to adding items such as a
VBScript file or HTML document to your VB.NET project? Once you have
these things added, how to you access them and use them in your code?
What exactly do you want to do with the files?

Well, I was thinking I might be able to dynamically edit the html
document and then export it. Or with the VBScript, pass some parameters
to it from my WinForm code and execute it. Is this possible? Or does
the VBScript have to be external to the project?



Ok let's say I have a VBScript file embeded in my executable. How would
I write the code that would execute the script?
Nov 20 '05 #10

P: n/a
Copyco,
Ok let's say I have a VBScript file embeded in my executable. How would
I write the code that would execute the script?
First I would have to question WHY? I would simply convert the VBScript to
VB.NET and execute it either directly or dynamically.

If I had a hard requirement to actually execute VBScript, (First I would
seriously consider changing the requirement, see above) then I would
consider using the ResourceManager to read the embedded VBScript file, write
it to a temp file, then use Process.Start to execute the temp file.

Are you asking for me to give you the code to perform the above steps? A
specific step?

To read the resource I would start here:
http://msdn.microsoft.com/library/de...ClassTopic.asp

http://msdn.microsoft.com/library/de...ClassTopic.asp

To write the temp file I would start here:
http://msdn.microsoft.com/library/de...ClassTopic.asp

To execute the temp file I would start here:
http://msdn.microsoft.com/library/de...tartTopic3.asp

Hope this helps
Jay

"copyco" <co****@anon.com> wrote in message
news:6f**********************@newssvr11.news.prodi gy.com...

Jay B. Harlow [MVP - Outlook] wrote:
copyco,
Well, I was thinking I might be able to dynamically edit the html
document and then export it.


Explain "export it", HTML added to a project is going to be "external" to the binary, which means you will need to add it to your setup project to
have it deployed. Alternatively you can set the "Build Action" to "Embedded Resource" to have the HTML file embedded into your executable, which means you may then need to "export it" to a file, to actually use it. The Build Action is available from the properties window when you select the file in Solution Explorer. You can use a ResourceManager and/or ResourceReader to get at the embedded file in your executable.

Or with the VBScript, pass some parameters
to it from my WinForm code and execute it. Is this possible?


You could use either the COM Script control, or Process.Start to exectu

Or does
the VBScript have to be external to the project?


You could have the VBScript embedded in the executable like you can an HTML file.

Hope this helps
Jay

"copyco" <co****@anon.com> wrote in message
news:5h**********************@newssvr11.news.prodi gy.com...

Herfried K. Wagner [MVP] wrote:
* copyco <co****@anon.com> scripsit:
>Can anyone tell me what the purpose is to adding items such as a
>VBScript file or HTML document to your VB.NET project? Once you have
>these things added, how to you access them and use them in your code?
What exactly do you want to do with the files?

Well, I was thinking I might be able to dynamically edit the html
document and then export it. Or with the VBScript, pass some parameters
to it from my WinForm code and execute it. Is this possible? Or does
the VBScript have to be external to the project?



Ok let's say I have a VBScript file embeded in my executable. How would
I write the code that would execute the script?

Nov 20 '05 #11

P: n/a
Jay B. Harlow [MVP - Outlook] wrote:
Copyco,
Ok let's say I have a VBScript file embeded in my executable. How would
I write the code that would execute the script?

First I would have to question WHY? I would simply convert the VBScript to
VB.NET and execute it either directly or dynamically.

If I had a hard requirement to actually execute VBScript, (First I would
seriously consider changing the requirement, see above) then I would
consider using the ResourceManager to read the embedded VBScript file, write
it to a temp file, then use Process.Start to execute the temp file.

Are you asking for me to give you the code to perform the above steps? A
specific step?

To read the resource I would start here:
http://msdn.microsoft.com/library/de...ClassTopic.asp

http://msdn.microsoft.com/library/de...ClassTopic.asp

To write the temp file I would start here:
http://msdn.microsoft.com/library/de...ClassTopic.asp

To execute the temp file I would start here:
http://msdn.microsoft.com/library/de...tartTopic3.asp

Hope this helps
Jay

"copyco" <co****@anon.com> wrote in message
news:6f**********************@newssvr11.news.prodi gy.com...

Jay B. Harlow [MVP - Outlook] wrote:

copyco,
Well, I was thinking I might be able to dynamically edit the html
document and then export it.

Explain "export it", HTML added to a project is going to be "external"
to
the binary, which means you will need to add it to your setup project to
have it deployed. Alternatively you can set the "Build Action" to
"Embedded
Resource" to have the HTML file embedded into your executable, which
means
you may then need to "export it" to a file, to actually use it. The
Build
Action is available from the properties window when you select the file
in
Solution Explorer. You can use a ResourceManager and/or ResourceReader
to
get at the embedded file in your executable.

Or with the VBScript, pass some parameters
to it from my WinForm code and execute it. Is this possible?

You could use either the COM Script control, or Process.Start to exectu

Or does
the VBScript have to be external to the project?

You could have the VBScript embedded in the executable like you can an
HTML
file.

Hope this helps
Jay

"copyco" <co****@anon.com> wrote in message
news:5h**********************@newssvr11.news.pr odigy.com...
Herfried K. Wagner [MVP] wrote:

>* copyco <co****@anon.com> scripsit:
>
>
>
>>Can anyone tell me what the purpose is to adding items such as a
>>VBScript file or HTML document to your VB.NET project? Once you have
>>these things added, how to you access them and use them in your code?
>
>
>What exactly do you want to do with the files?
>
Well, I was thinking I might be able to dynamically edit the html
document and then export it. Or with the VBScript, pass some parameters
to it from my WinForm code and execute it. Is this possible? Or does
the VBScript have to be external to the project?

Ok let's say I have a VBScript file embeded in my executable. How would
I write the code that would execute the script?


Actually, I'm using System.Web.Mail.MailMessage and
System.Web.Mail.SmtpMail.SmtpServer to send an e-mail message. The
problem is that I have .NET Framework v 1.0 which does not support SMTP
authentication. However, I'm able to write VBSript that does. I just
was wondering how I could execute the script from the executable itself
instead of run it externally. It just seems to be a clumsy way of doing
it.
Nov 20 '05 #12

P: n/a
copyco,
How does that saying go: use the right tool for the right job? :-|

Correct! System.Web.Mail does not handle SMTP authentication.

I would think that if you have a VBScript that does authenticated email,
than you can use the same code in VB.NET to also do authenticated email. As
VB.NET handles COM (almost) as easy as VBScript handles COM.

I would think our time would be better served figuring out how to convert
your VBScript code to VB.NET and getting it to run, rather then how to run
VBScript code from .NET...

For starters I would cut & paste the VBScript code into a new VB.NET source
file that has Option Strict Off & Option Explicit Off (which is most
VBScript like).

Hope this helps
Jay

"copyco" <co****@anon.com> wrote in message
news:v2*******************@newssvr24.news.prodigy. com...
Jay B. Harlow [MVP - Outlook] wrote: <snip>> Actually, I'm using System.Web.Mail.MailMessage and
System.Web.Mail.SmtpMail.SmtpServer to send an e-mail message. The
problem is that I have .NET Framework v 1.0 which does not support SMTP
authentication. However, I'm able to write VBSript that does. I just
was wondering how I could execute the script from the executable itself
instead of run it externally. It just seems to be a clumsy way of doing
it.

Nov 20 '05 #13

P: n/a


Jay B. Harlow [MVP - Outlook] wrote:
copyco,
How does that saying go: use the right tool for the right job? :-|

Correct! System.Web.Mail does not handle SMTP authentication.

I would think that if you have a VBScript that does authenticated email,
than you can use the same code in VB.NET to also do authenticated email. As
VB.NET handles COM (almost) as easy as VBScript handles COM.

I would think our time would be better served figuring out how to convert
your VBScript code to VB.NET and getting it to run, rather then how to run
VBScript code from .NET...

For starters I would cut & paste the VBScript code into a new VB.NET source
file that has Option Strict Off & Option Explicit Off (which is most
VBScript like).

Hope this helps
Jay

"copyco" <co****@anon.com> wrote in message
news:v2*******************@newssvr24.news.prodigy. com...
Jay B. Harlow [MVP - Outlook] wrote:


<snip>>
Actually, I'm using System.Web.Mail.MailMessage and
System.Web.Mail.SmtpMail.SmtpServer to send an e-mail message. The
problem is that I have .NET Framework v 1.0 which does not support SMTP
authentication. However, I'm able to write VBSript that does. I just
was wondering how I could execute the script from the executable itself
instead of run it externally. It just seems to be a clumsy way of doing
it.



I tried your suggestion but it isn't working. It gives me the error
'The "SendUsing" configuration value is invalid.' However this code
works fine as a VBScript. I'm just about ready to throw up my hands and
just call the script from my executable. Here's the code below.
Perhaps someone can point out the error.
\\\
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim objEmail = CreateObject("CDO.Message")
'Dim objEmail As New CDO.Message()
objEmail.From = "my_email@my_isp.net"
objEmail.To = "so*****@somewhere.now"
objEmail.Subject = "test message"
objEmail.TextBody = "This is a test."
objEmail.Sender = "my_email@my_isp.net"

With objEmail.Fields

..Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

..Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtp.swbell.yahoo.com"

..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

..Item("http://schemas.microsoft.com/cdo/configuration/sendusername") =
"my_email@my_isp.net"

..Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
"my_password"

..Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
End With

objEmail.Configuration.Fields.Update()

objEmail.Send()

End Sub
///
Nov 20 '05 #14

P: n/a


copyco wrote:


Jay B. Harlow [MVP - Outlook] wrote:
copyco,
How does that saying go: use the right tool for the right job? :-|

Correct! System.Web.Mail does not handle SMTP authentication.

I would think that if you have a VBScript that does authenticated email,
than you can use the same code in VB.NET to also do authenticated
email. As
VB.NET handles COM (almost) as easy as VBScript handles COM.

I would think our time would be better served figuring out how to convert
your VBScript code to VB.NET and getting it to run, rather then how to
run
VBScript code from .NET...

For starters I would cut & paste the VBScript code into a new VB.NET
source
file that has Option Strict Off & Option Explicit Off (which is most
VBScript like).

Hope this helps
Jay

"copyco" <co****@anon.com> wrote in message
news:v2*******************@newssvr24.news.prodigy. com...
Jay B. Harlow [MVP - Outlook] wrote:

<snip>>
Actually, I'm using System.Web.Mail.MailMessage and
System.Web.Mail.SmtpMail.SmtpServer to send an e-mail message. The
problem is that I have .NET Framework v 1.0 which does not support SMTP
authentication. However, I'm able to write VBSript that does. I just
was wondering how I could execute the script from the executable itself
instead of run it externally. It just seems to be a clumsy way of doing
it.



I tried your suggestion but it isn't working. It gives me the error
'The "SendUsing" configuration value is invalid.' However this code
works fine as a VBScript. I'm just about ready to throw up my hands and
just call the script from my executable. Here's the code below. Perhaps
someone can point out the error.
\\\
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim objEmail = CreateObject("CDO.Message")
'Dim objEmail As New CDO.Message()
objEmail.From = "my_email@my_isp.net"
objEmail.To = "so*****@somewhere.now"
objEmail.Subject = "test message"
objEmail.TextBody = "This is a test."
objEmail.Sender = "my_email@my_isp.net"

With objEmail.Fields

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtp.swbell.yahoo.com"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") =
"my_email@my_isp.net"

.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
"my_password"

.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")
= 1
End With

objEmail.Configuration.Fields.Update()

objEmail.Send()

End Sub
///


Hey nevermind. I got it working. I used the CDO.Configuration object
for the fields and that worked. Thanks for all the help.
Nov 20 '05 #15

This discussion thread is closed

Replies have been disabled for this discussion.