473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

windows Service vb.net

Hallo Everyone,

I have created a windows service which reads the .xml data and send email once a day automatically using vb.net. works fine. Now i would like to send configure my windows service by manual changing the email id (for example get a email id from the text box in the properties or just a right click menu). Is it possible to do so ?..

Thank you..
Mar 1 '10 #1
4 2590
sashi
1,754 Expert 1GB
Hi there,

A better idea would be to store the email addresses in an XML file. Write a simple procedure to read the contents of an XML file, kindly refer to below code segment;

Assuming this is your XML file

Expand|Select|Wrap|Line Numbers
  1.   <?xml version="1.0" encoding="utf-8" standalone="yes" ?> 
  2. - <Table>
  3. - <Product>
  4.   <Product_id>1</Product_id> 
  5.   <Product_name>Product 1</Product_name> 
  6.   <Product_price>1000</Product_price> 
  7.   </Product>
  8. - <Product>
  9.   <Product_id>2</Product_id> 
  10.   <Product_name>Product 2</Product_name> 
  11.   <Product_price>2000</Product_price> 
  12.   </Product>
  13. - <Product>
  14.   <Product_id>3</Product_id> 
  15.   <Product_name>Product 3</Product_name> 
  16.   <Product_price>3000</Product_price> 
  17.   </Product>
  18. - <Product>
  19.   <Product_id>4</Product_id> 
  20.   <Product_name>Product 4</Product_name> 
  21.   <Product_price>4000</Product_price> 
  22.   </Product>
  23.   </Table>
  24.  
Code to read xml nodes

Expand|Select|Wrap|Line Numbers
  1. Imports System.Xml
  2. Imports System.IO
  3. Public Class Form1
  4.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  5.         Dim xmldoc As New XmlDataDocument()
  6.         Dim xmlnode As XmlNodeList
  7.         Dim i As Integer
  8.         Dim str As String
  9.         Dim fs As New FileStream("products.xml", FileMode.Open, FileAccess.Read)
  10.         xmldoc.Load(fs)
  11.         xmlnode = xmldoc.GetElementsByTagName("Product")
  12.         For i = 0 To xmlnode.Count - 1
  13.             xmlnode(i).ChildNodes.Item(0).InnerText.Trim()
  14.             str = xmlnode(i).ChildNodes.Item(0).InnerText.Trim() & " | " & xmlnode(i).ChildNodes.Item(1).InnerText.Trim() & " | " & xmlnode(i).ChildNodes.Item(2).InnerText.Trim()
  15.             MsgBox(str)
  16.         Next
  17.     End Sub
  18. End Class
  19.  
Kindly refer to below attached link for more details, hope it helps :)

Basic XML Serialization in VB.NET
Mar 1 '10 #2
tlhintoq
3,525 Expert 2GB
Now i would like to send configure my windows service by manual changing the email id (for example get a email id from the text box in the properties or just a right click menu). Is it possible to do so ?..
To answer your original question, yes it is possible. You just use the .Text property of the textbox.

I would suggest that you *need* a configuration screen for your application. How else would the end user configure it for their use?

Combine these two answers so that you have a configuration screen, that then saves the users response. Then when launching your application it loads the saved config file.
Mar 1 '10 #3
Hallo tlhintoq,

Thank you for your reply. Actually i have a configuration file in which the email is stored and when the service run it reads the .xml file and send the data to the same email id everytime. Now what i need to do is suppose if the user need to run the windows service and send the xml data to someother email id ?.. That's why i thought some textbox when the service is right clicked and and the value of the textbox i can change the config file value and send to that email id. any idea ?..

Thank you..
Mar 1 '10 #4
tlhintoq
3,525 Expert 2GB
That's why i thought some textbox when the service is right clicked and and the value of the textbox i can change the config file value and send to that email id.
It sounds like you have thought out how you want it to work.
any idea ?..
So I don't understand what you are asking for.
Mar 1 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Michael Riggio | last post by:
Is there a way to have a windows service instantiate a class that is a web service, which will then be accessible to clients via HTTP? Thanks, -Mike
1
by: Artur Kowalski | last post by:
I have a NotifyIcon in my Windows Service project and I am trying to add a ContextMenu to this NotifyIcon or use some of the mouse events. Everything isn't working. I think so base class of the...
9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
1
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
0
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server -...
3
by: Doug Bailey | last post by:
I am trying to control a Windows Service via a Web Service interface. (I am developing in .NET2003) I am using the ServiceController object which allows me to read the state of the services with...
2
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
1
by: =?Utf-8?B?TWFuanJlZSBHYXJn?= | last post by:
Hi, I created a web service that I want to host in windows service. The problem is that if I host it as windows service it does not use the configuration file. I have to define the binding,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.