|
You could try by changing the Start value in the registry for your service (though I haven't tried this myself, but I figure it would work).
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ServiceName\
Start REG_DWORD (2) <- Change this value to either:
2 = Automatic
3 = Manual
4 = Disabled
|
|
|
|
|
Would it be any problem if we change it from Service Console ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I'm not sure I understand what you mean.. What would be a problem?
|
|
|
|
|
Hi All
I Have a Class name Product.cs that have attributes or properties like id Name Price etc...
Now on run time i have List Of Product Class...
Now i have to Translate this List In to Xml Local Client File... and Serialize and deserialize that..
Pls Help Me
Thanks In Advance..
Sachin
|
|
|
|
|
Serialisation is binary, not XML, AFAIK. I don't know if you can automatically have it done to XML, or if you need to write your own code.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hello Sir,,
I Want to Make a XML File from That Class List locally
|
|
|
|
|
OK, so you need to write a method which takes a stringbuilder, or an XML builder or something, and adds the class instance to the XML document being built. Your solution is to manually write code that creates XML, or reads XML and uses it to create a class instance. Ideally, you want to call a method as you iterate over each class instance, and it builds the XML that way.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
You don't necessarily have to write your own code to manually serialise a class. The XmlSerializer class can handle most of the work.
|
|
|
|
|
here i have an example for you to serialize and deserialize a class
public string SerializeObject ( Object pObject, Type et )
{
try
{
String XmlizedString = null;
MemoryStream memoryStream = new MemoryStream ( );
XmlSerializer xs = new XmlSerializer ( et );
XmlTextWriter xmlTextWriter = new XmlTextWriter ( memoryStream, Encoding.UTF8 );
xmlTextWriter.Formatting = Formatting.Indented;
xmlTextWriter.Indentation = 4;
xs.Serialize ( xmlTextWriter, pObject );
memoryStream = ( MemoryStream ) xmlTextWriter.BaseStream;
XmlizedString = UTF8ByteArrayToString ( memoryStream.ToArray ( ) );
return XmlizedString;
}
catch ( Exception e )
{
System.Console.WriteLine ( e );
throw new Exception(e.Message,e);
}
}
public Object DeserializeObject ( String pXmlizedString, Type e )
{
XmlSerializer xs = new XmlSerializer ( e );
MemoryStream memoryStream = new MemoryStream ( StringToUTF8ByteArray ( pXmlizedString ) );
XmlTextWriter xmlTextWriter = new XmlTextWriter ( memoryStream , Encoding.UTF8 );
return xs.Deserialize ( memoryStream );
}
and here the class how it looks.
[Serializable()]
[XmlRoot("Attrib")]
public class AttributeClass
{
string sIdentifier;
string sAlias;
[XmlElement("Identifier")]
public string Identifier {
get { return sIdentifier; }
set { sIdentifier = value; }
}
[XmlElement("Alias")]
public string Alias {
get { return sAlias; }
set { sAlias = value; }
}
}
and here the AttributeCollection as Class to serialize it..
[Serializable()]
[XmlRoot("AttribsList")]
[XmlInclude(typeof(AttributeClass)),
XmlInclude(typeof(System.Collections.Generic.List<AttributeClass>))]
public class AttribsList : System.Collections.Generic.List<AttributeClass>
{
public static AttribsList LoadLayoutFromFile(string path)
{
try
{
string data_str = Core.SerializeHelper.ReadFromFile(path);
Core.SerializeHelper sh = new Core.SerializeHelper();
AttribsList list = (AttribsList)sh.DeserializeObject(data_str,typeof(AttribsList));
return list;
}
catch
{
return null;
}
}
public static void SaveLayout(AttribsList lst, string path)
{
Core.SerializeHelper sh = new Core.SerializeHelper();
string data_str = sh.SerializeObject(lst,typeof(AttribsList ));
Core.SerializeHelper.SaveToFile(path,data_str);
}
}
}
|
|
|
|
|
Thanks A Lot Brother!!!
Cheers
|
|
|
|
|
HI...
I did DataGridView Search ... As When i type a Text box , the on key up call back Event will filter a Data Grid View Data's ... When i was type the string in fast... Filter for each char So The Searching is very slow and Also Sometimes the Application will hang... How can i Handle this... Or have any other best idea can u share with me
Anish S
|
|
|
|
|
You Can Use Threading to Cope up this problum//// 
|
|
|
|
|
How are you doing the search, what is the underlying datasource, table, bindingsource or collection or List<>.
Depending on the size of your data set and the underlying collection and the method you are using to filter the data it all impacts on the speed. We need some further info to help.
As stated by Sachin you could use a thread to do the filtering but I doubt it will be a satisfactory solution, I think you may have a problem with your design.
|
|
|
|
|
Thanks for reply
I am using List<>... Now i m using List of class object , which have data member , Each member have want to display...
I am searching Code mentioned below...
foreach (SongProfile songPro in songList_)
{
if (searchField_.Equals("File Name"))
{
if (songPro.fileName_.ToLower().Contains(search))
{
tempSongPro = new SongProfile(songPro);
listOfSongPro.Add(tempSongPro);
}
}else if (searchField_.Equals("Song Name"))
{
if (songPro.songName_.ToLower().Contains(search))
{
tempSongPro = new SongProfile(songPro);
listOfSongPro.Add(tempSongPro);
}
}
}
Here after new SongPRofile obj List is Loaded in DataGridView...
|
|
|
|
|
Hi, i have a webbrowser control and i have a button which takes the html from the webbrowser and puts it into a text box. Here is the code:
status.Text = webBrowser1.DocumentText;
However this only seems to work half the time, and when it does not work, i get the error of "File not found".
Or, sometimes it will work once and not a second time.
How can i fix this or how can i do this another easy way?
Must be through the webbrowser control as the client is logged in though it.
Thanks.
|
|
|
|
|
discreetz wrote: However this only seems to work half the time, and when it does not work, i get the error of "File not found".
This sounds strange. Why would you get "File not found" when accessing a piece of text? I would suggest using the debugger to trap your program at the point of error and examine the stack trace and variables to identify exactly which statement is failing and why.
|
|
|
|
|
how to search for a specific file in current directory?
|
|
|
|
|
You have to do the search yourself, by retrieving all the files (System.IO.Directory.GetFiles(folderName) ) in a folder and comparing them to your search criterias - for instance the file name.
You can check out this link[^] if you want to know how to do a recursive search.
|
|
|
|
|
Calla is right, but there is an easier method: DirectoryInfo.GetFiles[^] which allows a search string to limit to just matching filenames.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Cool.. Never used it but good to know!
|
|
|
|
|
You can recursively get the files in a Directory and using string comparision you can compare whether a particular file contains the search string.
What about the performance when the number of files and their size is large, say in GBs? How google and other search engines are handling this issue (Tera bytes of data)?
One simple technique is indexing and searching. Just like an index in a book, so that you can quickly go to the page where the word is present.
Using .Net and c# how will you do? You can use Lucene.Net, an Open Source Indexing and Searching library. Look at this code project article Introducing Lucene.Net[^].
|
|
|
|
|
How to create a folder in any drive by C# .Net Command
|
|
|
|
|
C# doesn't have commands; only command lines have commands.
Perhaps something in the System.IO.Path class might be of use.
|
|
|
|
|
Look into the System.Io namespace. In there, you'll find the Directory and DirectoryInfo classes. You'll be amazed how easy it is.
|
|
|
|