|
Write a webbrowser with that built-in.
|
|
|
|
|
i am writing a windows service not a web service.... any idea..
|
|
|
|
|
I meant write a webbrowser that logs keystrokes and make the kid use it to access the Web.
|
|
|
|
|
i 2 had this idea first... but this cannnot go long... like chat programs.. which are many so may be a windows service may help/...
|
|
|
|
|
you mean a 'key logger'? very naughty lol
I found a good article somewere once, dont know where thou so you will have to look yourself.
People here dont usually help with this sort of question unfortunately, I would post like but i really dont remember where it was or what I searched for so
|
|
|
|
|
Hi All,
I have a struct that contains data such as ID, Name etc.
I have a List of instances of that struct.
I then have a method which returns a struct from the list based on an ID value pased as a parameter.
But my problem is if the id does not match any of the structs in the list I would like to return a Null value. Any ideas how to get around this?
I have thought to have a bool property in the struct that states if null or not null, but i would ideally prefer to return a null value rather then create an empty struct with only IsNull = true set and then returning that.
Thanks for any advice offered
|
|
|
|
|
Make your method return an instance of Nullable<struct> (reference[^]).
It automatically adds an "HasValue" property and can be also compared with null.
|
|
|
|
|
Well I will mark as answer as it does answer the question I posted , but appears this way means the struct values are read-only.
I think I will stick with the IsNull property for ease of use, thanks thou
|
|
|
|
|
While it's true that the "Value" property is read-only, you can always assign your nullable variable to an instance of the struct using the = operator. See the following code snipper
public struct MyStruct
{
public int Field1 = 0;
public int Field2 = 1;
};
class Program
{
static void Main(string[] args)
{
MyStruct str = new MyStruct();
str.Field1 = 1;
str.Field2 = 2;
Nullable<MyStruct> nul = null;
if (nul.HasValue)
Console.WriteLine("VALUE IS {0},{1}", nul.Value.Field1, nul.Value.Field2);
else
Console.WriteLine("VALUE IS EMPTY");
nul = str;
if (nul.HasValue)
Console.WriteLine("VALUE IS {0},{1}", nul.Value.Field1, nul.Value.Field2);
else
Console.WriteLine("VALUE IS EMPTY");
}
}
|
|
|
|
|
Thanks, but you cant assign nullable struct to struct i.e. str = nul;
which means I wouldnt be able to save the str back to the list, without copying the values from null to str first.
|
|
|
|
|
Yes, you can't do that because you don't know if nul has value or not.
You can do str = nul.Value, or, you can use a list of nullable structs from the beginning.
|
|
|
|
|
Hi,
if you need to hold some data and the ability to indicate there is no data, use a class instead
of a struct, and null for "no such thing".
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Friday, June 10, 2011 11:54 AM
|
|
|
|
|
Or define an Empty member to return for those cases:
if ( x != thing.Empty ) ...
|
|
|
|
|
hi,
When I click one button.I called One webservice that webservice have one method.it will return one Image byte Array.I want to display that Image via Javascript.ie.Displaying Image From Server with the help of Webservice and Javascript.
Is it Possible?Or Give Me another solution.
Please Help Me.
With Regards,
Justin Dhas. Y
|
|
|
|
|
justindhas wrote: Give Me another solution
Write an active X control.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi
Thanks for ur reply.Other than ActiveX any possible.
Thanks & Regards,
Justin Dhas.
|
|
|
|
|
helu evry one...
i need help in starting a windows service from a windows form.. the windows servics is manualy sarted and i need to start from the windows form. the windows service is windows service2. thans..
|
|
|
|
|
System.ServiceProcess.ServiceController can be used to start a service by providing a service name ...
I think it looks like the following way...
<br />
ServiceController service = new ServiceController(serviceName);
<br />
service.start()
Use Google for ServiceController implementation.
"Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)
|
|
|
|
|
Thank you very uch for the code...
|
|
|
|
|
I have an array list of serial port configuration. i want to call these configuration later in the program. So how can i call the configuration from array ?
using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.IO;
using System.Windows.Forms;
using System.IO.Ports;
using System.Threading;
using System.ComponentModel;
using System.Data;
using System.Drawing;
public class Class1
{
public Class1()
{
}
public ArrayList SerialPortContainer = new ArrayList();
private string config_file = "C:/achu/config.txt";
private string PhoneNumber;
private string ServiceCentre;
public bool test()
{
try
{
string line;
TextReader tr = new StreamReader(config_file);
System.IO.StreamReader objReader;
objReader = new System.IO.StreamReader(config_file);
int NumberOfLines = 0;
while ((line = tr.ReadLine()) != null)
{
NumberOfLines++;
}
string[] ListLines = new string[NumberOfLines];
for (int i = 0; i < NumberOfLines; i++)
{
ListLines[i] = objReader.ReadLine();
string[] values = ListLines[i].Split(new char[] { '$', '#' });
string[] PortSplit = values[0].Split(new char[] { ':', '#' });
string PortName = PortSplit[1];
string[] BaudSplit = values[1].Split(new char[] { ':', '#' });
int BaudRate = Convert.ToInt32(BaudSplit[1]);
string[] BitsSplit = values[2].Split(new char[] { ':', '#' });
int DataBits = Convert.ToInt32(BitsSplit[1]);
string[] NumberSplit = values[3].Split(new char[] { ':', '#' });
PhoneNumber = NumberSplit[1];
string[] SerNumberSplit = values[4].Split(new char[] { ':', '#' });
ServiceCentre = SerNumberSplit[1];
SerialPort serialPort1 = new SerialPort();
serialPort1.PortName = PortName;
serialPort1.Handshake = Handshake.RequestToSend;
serialPort1.BaudRate = BaudRate;
serialPort1.DataBits = DataBits;
serialPort1.Parity = Parity.None;
serialPort1.StopBits = StopBits.One;
serialPort1.DtrEnable = true;
serialPort1.Open();
SerialPortContainer.Add(serialPort1);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return false;
}
return true;
}
public void ATTest()
{
string val = Convert.ToString(SerialPortContainer[1]);
MessageBox.Show(val);
}
}
|
|
|
|
|
[Cannot understand the question clearly]...hmmm..Ok if you want to access those array values in the ATTest() method,declare those array variables as global variables i mean at class level not inside the method Test().
"Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)
|
|
|
|
|
Using a field in the class, like myConfigArray? If you have to use it in another class think about using static fields that are public.
Regards
Sebastian
|
|
|
|
|
hiii
First Option:
Pass The Array to the function...
Second Option:
Declare The Arryas as "Class" Private Members.....
|
|
|
|
|
Hello there.
I'm developing a C# application that interracts with a contactless smart card readers ( MiFare 1k and MiFare 2k readers), but since those kind of card readers dont support PS/SC the WinScard API won't help.
(For a start ... i need a list of all connected contactless smart card readers )
So i suppose i should loop through all connected usb devices and send some APDU command so they can give their status ( identify them if they are contactless smart card readers )
Is that the right way to do that ? If someone has any information about this issue ... i'm opened to any suggestions
I've been searching around the web for about 3 whole days and i'm nowhere .... Please help me
|
|
|
|
|
You'd normally go to the manufacturer and get the Software Development Kit to do this. I can't believe a manufacturer put out a piece of hardware and didn't supply an SDK so you can use it in your own code.
|
|
|
|