|
Hello!
i just started to write a windows service.
i put in the OnStart method the things i want to do, but it doesn't work..
any suggestion?
Thanks
Enrico
VentoEngine corp.
Program your life ^^
|
|
|
|
|
Enrico,
Unfortunately, writing a Windows Service isn't as easy as writing anything else in the .NET framework. You need an installer project to install your service. Once installed, it should at least show some signs of life.
ventomito wrote: but it doesn't work..
What part doesn't work? Do you get an error message? What does or doesn't happen, and what are you doing to try to get it to work? Can we see some of your code?
|
|
|
|
|
Hi,
Can anyboyd tell me how can i prevent user from Copy pasting text in Text Boxes and the Cells of a grid? Is there any way of doing that?
Wasif Ehsan.
|
|
|
|
|
Set the readonly property to true;)
VentoEngine corp.
Program your life ^^
|
|
|
|
|
How can I open a file in Autocad available on http://server using c# program.?
How can I savd a file in Autocad on http://server using c# program.?
How can i use the Stream in Autocad(file open and save using stream) in c#?
|
|
|
|
|
Hi All,
I have a program that wants to access a mapped network drive. When the program starts up it checks to see if the directory exists and then grabs the file.
The problem is that when i turn on my computer and start programming this bit of code does not work until I open up windows explorer and click on the drive. Once I have done this then the code works fine.
Is there a solution to 'wake' the mapped drive so that I have access to it?
Thanks in advance.
Stephen
|
|
|
|
|
Stephen,
Your problem isn't so much that it's sleeping, but rather that you're missing two steps that Explorer does: NetBIOS browsing and authentication. You may be able to avoid browsing if you're on an AD domain, but the authentication doesn't happen on its own.
For one, try accessing the machine from its UNC path (something like \\machinename\share\folder) instead of as a mapped drive. Drive letters are a vicious hack left in only for backwards compatability to the DOS days and for marketing/sales folks.
If that falls short, look at some of the documentation for the Linux SAMBA project. There are some pretty clear and simple descriptions there of exactly what steps happen when you double-click on a mapped drive.
|
|
|
|
|
Please tell me how we can run a program pernamently on my desktop.
For example: i write a program remind me about birthday of all my family members and friends. i want everytime i turn on my desktop, this program will run automaticly and tell me all birthays in this week.
Thanks
|
|
|
|
|
Put a shortcut into the Programs->Startup area and when your computer starts it will execute the application.
|
|
|
|
|
Its very simple
1. Put its exe in startup folder on your system
2. Or make your program as a Windows service and configure to start as soon as your system starts.
Regards,
Wasif Ehsan
|
|
|
|
|
Hi ,
I came across a problem while i was learning C#-
public class MyClass
{
int n;
}
public struct MyStruct
{
int n;
}
SomeMethod()
{
MyClass[] xClass = new MyClass[3]; //- Statement 1
MyStruct[] xStruct = new MyStruct[3]; //- Statement 2
}
Statement 1 - causes an array of 3 references all referencing null to be created.
Statement 2 - causes an array of 3 MyStructs to be created and also intialized. n is also initialized to 0
Why is there a discrepancy in behavior? Does C# support any syntax that would allow me to call MyClass constructor thrice (no statics) in one go? It's just curiosity, I'm not sure if there is any benefit in doing it this way..
Regards,
|
|
|
|
|
venkat456 wrote: Why is there a discrepancy in behavior?
Its to do with default value for value types and reference types. You need to call 'new' on reference types to create instances.
|
|
|
|
|
Thanks a lot!
I still feel this is wrong. For example if you are using generics, the code has to first detect if the generic type is ReferenceType and if it is, extra calls to new should be made.
I see that structs cannot be made a generic type but the problem still exists for primitive types like int, double...
T xGeneric = new T[10];
if(!(xGeneric is System.ValueType))
{
for(int i =1; i<10;i++)
{
xGenric[i] = new T();
}
}
|
|
|
|
|
venkat456 wrote: I still feel this is wrong.
How is this wrong? Value types are created inline and that's why creating an array of valuetypes results in them being initialized with default values. An array of reference types stores just that, references to instances on the heap, so they obviously get initialized to null.
If you still think that's wrong, consider the following C++ snippet.
int arr[10];
vs
int **arr = new int*[10];
The second statement will create an array of int * pointers, all initialized to NULL. You can consider reference types similar to that.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi,
I am with a small problem in my application, I have a forn with two userControl, created dynamically and I need to know with I do to draw a line to connect the two userControls.
|
|
|
|
|
I've got 2 columns, Column Catagory, and Column Item. I've got them displaying from drop down boxes, but when I pick a catagory, I dont know how to force the Item Column to update for the items from the selected Catagory. I hope that made sense... (no, I'm not doing this for homework, and my database doesn't actually involve cars)
[Catagory] [Item]
|Car| |Acura|
|Truck| |Accord|
|Tacoma|
Hopefully the above is a reasonable "view" of what I've got.
There is a catagory table, and an item table. The item table has the catagory number from catagory table with each item. Thanks for the help.
|
|
|
|
|
Hi,
DataSet ds;
DataViewManager dsview;
In the form_load write this:
string constr = "Data Source=KALPANA\\KAL; Trusted_Connection = yes;Database=Northwind";
SqlConnection con = new SqlConnection(constr);
SqlDataAdapter da1 = new SqlDataAdapter("SELECT * FROM category", con);
ds = new DataSet("category");
da1.TableMappings.Add("Table", "category");
da1.Fill(ds);
SqlDataAdapter da2 = new SqlDataAdapter("SELECT * FROM item", con);
da2.TableMappings.Add("Table", "item");
da2.Fill(ds);
string dt = "";
for (int i = 0; i < ds.Tables.Count; i++)
{
dt += "Table Mappings" + i.ToString() + " " + ds.Tables[i].ToString() + " ";
}
//MessageBox.Show(dt);
DataRelation relcatitem;
DataColumn colmast;
DataColumn coldet;
colmast= ds.Tables["category"].Columns["catid"];
coldet = ds.Tables["item"].Columns["catid"];
relcatitem = new DataRelation("relcatitem", colmast, coldet);
ds.Relations.Add(relcatitem);
for(int j=0;j
|
|
|
|
|
Hi,
Reply me whether my code is works for u or not.By seeing ur question i tried that program.
|
|
|
|
|
Hi all,
I am trying to develop a text mining engine and in it i need to work on large number of files...and deal with lots of words... i ve made a word class which has following variables
public string term;
public int df;
public ArrayList tf = new ArrayList();
public ArrayList docID= new ArrayList();
public static int count;
here term is the variable wich contains the actual value of the word. now when user queries for a word i need to search all these terms and find out whether the term user wants exists or not....
i ve this word class sorted w.r.t the "term" variable so it means that i can apply binary search for finding the user query.....i m doing this by adding all the term variables of the class in an arraylist and then applying binary search over it....but the problem is that i need to know the index of the arraylist where the user's queried term exists.....and i dont know the way to find out the index i ve added the sample chunk of code here.....anyone plzz help
for(int i = 0; i < Terminology .count; i ++ )
{
allTerms.Add(word[i].term);
}
for(int j = 0; j < queryList.Count; j ++)
{
if(allTerms.BinarySearch(queryList[j]) >= 0)
{
need to know the index of allTerms ArrayList.
}
}
looking forward for help
Regards,
|
|
|
|
|
Ehh, BinarySearch returns the index. If it just indicated if the item was present or not it would have returned a bool.
It is also worth noticing that in case the item is not found, the return value indicates the position the item should have been at if it was present (useful for inserting in the list after it is sorted).
All of this is in the MSDN documentation.
|
|
|
|
|
i really thought that it just returns a bool value....now i understand a little bit....but it wud b really helpful if u illustrate it with a little example
thxx in advance
regards,
|
|
|
|
|
Did you look at MSDN[^] as I wrote? Always look in MSDN first - it is the official documentation for the .NET Framework, and it contains a decent amount of samples.
|
|
|
|
|
Hello, I have looked everywhere and can not find an example of how to mimmic the right click "save picture as" in Internet Explorer. I am building my own tabbed web browser and want to right click an image and have the "save picture" dialog box pop up. I am using VS 2005. Thank you for any information.
|
|
|
|
|
How are you implementing HTML rendering?
If you're just using the MS browser control, this is difficult. It'd depend mostly on having an API hook into mapping between x, y coords and rendered elements within the control. If there's one, it's a pretty easy task (ask).
If you wrote the HTML page rendering yourself, you probably know how to do this already, but just inspect the x, y coords from the right-click event args and see if it falls within the bounds of an image. If it does, you've already rendered the image, so getting a handle to the stream and writing it to disk should be pretty easy.
|
|
|
|
|
If you want complete control you can use the WebBrowser.Document.GetElementFromPoint method. This will return a reference to the HtmlElement under the mouse. Check that the HtmlElement.Name is IMG (i.e. an image tag), if so then you can use HtmlElement.GetAttribute("src") to retrive the url of the image.
You can then use the System.Net.WebClient.DownloadFile method to actually download the file when the user has specified where the image is to be saved.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|