|
Thanks you all,
It was kinda a pain to convert to list and back to array. so what i did was to write an algorithm for it.
int[] myarr;
int index;
in val;
for (int i= myarr.length-1; i > index ; i--)
{
myarr[ i ] = myarr[i-1]; // shift everything;
}
myarr[index] = val;
Well there's always a way to get around thing.
Donkaiser
|
|
|
|
|
I declared a property of type string. In one of my codes i am using the value of property and storing into a local string variable. But i am unable to use ToString(), IndexOf, ToUpper() etc methods of local string variable. Any reason, Help very urgent
thanks
san
|
|
|
|
|
kumar.bs wrote: But i am unable to use ToString(), IndexOf, ToUpper() etc methods of local string variable.
What do you mean by that? You should post the relevant code so that we can see the situation in context.
Josh
|
|
|
|
|
public string DisplayFormat { get, set };
string strDisplayFormat = DisplayFormat;
on strDisplayFormat variable , i could not able to use ToString(), IndexOf() methods
san
|
|
|
|
|
What do you mean by saying that you can't use those methods? What actually prevents you from doing so, a compiler error? If so, what is the error message?
|
|
|
|
|
Josh Smith wrote: a compiler error
I put my money on Intellisense not showing it
|
|
|
|
|
|
I wrote this function to handle an exception for a FileSystemWatcher, so it gets called like this:
watchSamples01.Created += new FileSystemEventHandler(MoveFileFromSharedLog1);
where watchSamples01 is my FileSystemWatcher, and MoveFileFromSharedLog1 is my event handling function.
The method looks like this:
private static void MoveFileFromSharedLog1(object sender, System.IO.FileSystemEventArgs e)
My question is how do I send an additional parameter to my method? I would like to send an integer value to the MoveFileFromSharedLog1 method. If I try to add int x after System.IO.FileSystemEventArgs e I get this error:
Error 1 No overload for 'MoveFileFromSharedLog1' matches delegate 'System.IO.FileSystemEventHandler'
How should I do this?
|
|
|
|
|
You can't alter an event handling method's signature and expect the event's associated delegate to accept your method as a valid target. The method's signature must conform to the delegate's signature. What you should do is store the integer in the class which contains the method, as a field exposed as a property.
Josh
|
|
|
|
|
You can't.
Simply spoken, when registering to the Created event, you tell the FileSystemWatcher to call your MoveFileFromSharedLog1 method whenever this event occurs. The registered method must have a specific signature (defined by delegate FileSystemEventHandler') cause otherwise it couldn't be called. The FileSystemWatcher would have no knowledge what to do with an additional int parameter and which value it should have.
Anyway, what should this int parameter be for?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
I need to setup a path to write a file to, and the path changes depending which folder the file was created on. I figured it would be quick and easy to send in a int parameter and just say writePath =("c:\path\blah" + x); so if x came in as 1 it would write to the c:\path\blah1\, 2 would write to c:\path\blah2\ and so on.
As it is now I have 2 MoveFileFromsharedLog methods and the only difference is the writePath variable. Seems very wasteful, but not sure how else I could do it.
|
|
|
|
|
aquacadet wrote: the path changes depending which folder the file was created on
Use the FileSystemEventArgs.FullPath property to determine in which folder a file was created.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
hi all,
i have a form with many labels, textboxes or button on it.
i copied each and every labels', texboxes' and buttons' texts and place them in a txt file. then translated everything between (")-(") into english.(mainform is in my language.)
and through menustrip one can select his/her desired language. (english or turkish)
everythin works fine and i can change every label, textbox or button text.
but for messagebox'es i havent got a solution yet
for example:
in turkce.txt: this.label1.Text="Ingilizce"; translated as:
in english.txt: this.label1.Text="English";
but for error messages for now i cant do nothin
there's no this.messagebox.... ?
do i have to check the form's language first and show error messages according to the language ? or is there an easy way to reach and change text displayed in messageboxes as well ?
help please ...
-- modified at 10:41 Friday 19th May, 2006
|
|
|
|
|
Hi!
Since MessageBoxes use the language of the Language Pack you're got installed for your .NET framework, I don't think this will be possible.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
I’ve made some reports using the ReportViewer and Reports (*.rdlc-files) in visual studio 2005. I really enjoy the ReportViewer!! My reports is now generated direct from my SQL 2005 database but I now want to generate a report from a typed DataSet that is instantiated locally in the program (my typed dataset is a subset of info from the database).
How do I connect the .rdlc-file to my object? I see that I can choose Add new data source -> Object but I want in runtime to do that on my instantiated DataSet. Is that possible?
I for sure have missed something and all tips are welcomed!!
_____________________________
...and justice for all
APe
|
|
|
|
|
I have to print the contents of an html file (or stream) to a printer.
I've hunted around a bit and it seems I must use the graphics object to format my lines one at a time to send them to the printer.
In looking at some samples, this particular line of code seems to be common :
ev.Graphics.DrawString(line, printFont, Brushes.Black,
leftMargin, yPos, new StringFormat());
This is a concern to me, as my html has images in it. I dont believe I want to tell the DrawString what color to use.
Probably cause I'm new to dealing with this type of problem, I simply dont see what I really need to do.
Can someone point me to somthing that might help clear my head up?
To restate, I have HTML that I must (thru C# code) send to the windows installed default printer - I just dont see how-to!
Thanks!
-- modified at 10:20 Friday 19th May, 2006
Oh, in looking around some more I see it might be helpful to add that this HTML is being generated via XML/XSL transform inside a web service which has no visual components.
|
|
|
|
|
You could use a instance of the AxWebBrowser IE control. You have to have your HTML written to file somewhere, then navigate the IE control to it and use it to print the file.
private AxSHDocVw.AxWebBrowser axWebBrowser1;
private void Print() {
object o = null;
axWebBrowser1.Navigate(@"C:\print.html", ref o, ref o, ref o, ref o);
axWebBrowser1.ExecWB(
SHDocVw.OLECMDID.OLECMDID_PRINT,
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER,
ref o, ref o
);
}
But if you are masochistic you can draw images with your Graphics object too. Not sure I'd be interested in writting my own HTML renderer.
|
|
|
|
|
Thanks - that helped me move forward a little. Apparently in 2005 you must use WebBrowser.
I tried...
WebBrowser webBrowserForPrinting = new WebBrowser();
webBrowserForPrinting.Visible = false;
webBrowserForPrinting.Url = new Uri(@"c:\\Checkpoint\\websites\\printservice\\app_data\\books.html");
while (webBrowserForPrinting.ReadyState != WebBrowserReadyState.Loaded)
{ };
webBrowserForPrinting.Print();
webBrowserForPrinting.Dispose();
I now get an error in a browser window:
System.Threading.ThreadStateException: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment.
at System.Windows.Forms.WebBrowserBase..ctor(String clsidString)
at System.Windows.Forms.WebBrowser..ctor()
at Service.PrintXML()
Anyone have any good ideas as to what to do with this one?
As I said - its in a web service, I dont want the browser to be visible either.
Thanks!
|
|
|
|
|
Hi all, i want to create a control that does just like a panel into Visual Studio.
If i want to set a background image i go on open file dialog at the voice background image and load the image.
I know how create this property for my cotnrol but when i laod the image it doesn't is set in my resource project directory as Visual Studio does.
How can i do it in design time?
|
|
|
|
|
hi guys!
need some help again..
how can i
call datagridview double click event on button click of a form..
abhinav
|
|
|
|
|
No matter how hard you try, the CLR won't let you raise an event from an object which does not expose that event. That's just the way it is. Why do you want to do that, anyways? Could you not accomplish whatever it is you're attempting to do by calling the method which executes when the DoubleClick event is raised (instead of raising the event)?
Josh
|
|
|
|
|
I've made a small deployment project. in that when i am trying to rollback installation if serial number entered for that by a user is wrong then i recieving an exception as "saved state got corrupted.100 % restoration won't be done". How to get rid of this exception and rollback the installaion too.
manu sharma
|
|
|
|
|
I have developed a software that takes text documents as input and after performing a few steps it generates an inverted index....and it takes a little time to do so and i want to display a percentage progress as text label.....and i ve calculated the time taken by each step in this and then changed that time into to percentage and displayed it after the button click.....but the problem now is that when i change the input files this percentage starts to look stupid.....so i want to ask that how can i calculate the percentage wich will work for all inputs..........
Looking forward for help
Regards,
|
|
|
|
|
Okay
That's for sure a bad idea to do the time calculation since for the same file, on different machines of different speeds or even in your own machine when it is busy, times may take shorter or longer....
The idea is simple: you should make get to know the size of the input file (in characters, bytes etc.) and then simply check where you are processisng now... For example if the file is 100 characters long, and you are now processing the 23rd character, you are at 23% of your process....
Hope this could give you the idea....
|
|
|
|
|
Sir the real problem is that i m reading about 350 files and i m performing one step at a time ist i read all the files then in the next step i remove the white spaces from it in next step i remove some unecessaray words from this dataset and few more steps like that i m doing it this way that i ist checked the total execution time of the program then i checked that how much time each of these steps take and then i divided that into percent of total time and then in each step i checked on the basis of all the files present and the file already processed......i hope u understand the problem now
looking forward for help
Regards,
|
|
|
|