|
Neha_Gupta wrote: and then u can use
rand.Next(1,100);
to generate a random no. between 1 & 100
That will generate a random number between 1 and 99.
---
b { font-weight: normal; }
|
|
|
|
|
Thanx Guffa for correcting me
NEHA GUPTA
|
|
|
|
|
Thanks Guffa. This information helped me too. I was using the random generation in my program and was thinking the probability of generating last number could be less... but now came to know it does not generate. Intead it generates till one less(as in your example betwen 1-99) Thanks again!!!
- ashish
|
|
|
|
|
dear programmers
i have an application made in c# support multi language when installing on other pc i dont want to install language support from windows cd i want to intall it through my installing program how can i do it.
how to install asian language support for windows when installing my software any idea or where can i get setup files thant can run when installing a software.
sikandar
|
|
|
|
|
The whole setup this implies is difficult at best (if you are just looking to have your program running in a certain language). It probably would be best to get a Multi-Language Windows-Release and install your program there, then choose your program's display language according to the language options currently selected in Windows.
However, I would roam the net and look for a language installation package, then add it as a script to your install-packet-creator.
Or, x-copy-installations, check if the computer has the language support and run the language installation if it does not.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
can u plz tell me where i can get multi language support file..
sikandar
|
|
|
|
|
Hi,
Im looking forward to create my own component (Eg:Combobox) using C# by adding my own appearence and features without inhariting inbuilt controls in .net framework.But still i couldn't find the way of doing this.Please send me a way to do this and related references.
Thanking you,
Pubudu
|
|
|
|
|
|
This is my comparer:
public class movieIdCompareValueClass:IComparer
{
public int Compare(object a, object b)
{
return ((allInfo)a).movieId.CompareTo(((allInfo)b).movieId);
}
}
I am using it in:
found = Array.BinarySearch(outerContents, movieId, new movieIdCompareValueClass());
I have tried a couple different ways to set up the comparer, but I always get a runtime error on the above line:
System.InvalidOperationException
Additional information: Specified IComparer threw an exception.
What is causing this error? Is the comparer looking beyond the last element of the outerContents array? If so how do I prevent it?
|
|
|
|
|
It would be nice to know what exception the IComparer threw. It should be accessible through the InnerException property of the thrown InvalidOperationException .
If I have to guess, I'd say that you are getting an InvalidCastException . It seems your outerContents array contains allInfo objects as you're casting the objects a and b to it in your compare method. As object to search for you pass in something called movieId, so I guess it's a plain int or something similar which can't be cast to allInfo.
"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 may be off base, but at first thought, you are using a compare to complete a compare.
Try writing your own comparer long hand.
|
|
|
|
|
hi all,
can anyone tell me where reflection finds its use in a real time system?
thanks in advance,
lavanya
|
|
|
|
|
It will be used when you want to
-load an assembly
- iterate the methods in assembly
- Call the methods etc.
@ runtime
Say for eg in my project i will get the method and assembly name in an xml, So my exe will read the XML file and has to execute the method,
My Project: Test engine - it will get teststeps(method names) in an xml file from a server and will execute in the client machine
Hope you got atleast one real world application example
|
|
|
|
|
Beside what engsrini alrready said, you can think of it as an advanced way of dynamic coding. Currently it isn't widely used, but I believe in the future it may. One example is like making your own forms editor. Something like MS Access where your users can make a form and bind it to the Db. Maybe you want to add custom controls in your form.
Another example is using reflection as a mean of adding update capability in your program, where you dunamically instantiate a class from a dll and call certain methods. When you update all you need to do is to replace that dll. I know this is crap but it is possible.
One last thing is to use reflection to reference to a library that is not included in your program by default -for example optional downloadable plug-ins to your program-, and make error checking when using the classes in it. So that users can un/install plug-ins as suits them without changing anything in the main program. If a plug-in makes an error or was deleted by mistake, using reflection and not hardcoding the references into your program will give you flexibility and prevent your program from crashing.
That was some of the things I could come up with in 5 minutes. Creativity has no limits.
Regards
|
|
|
|
|
Lavanya
We have a business rules engine which allows us to bind in custom objects at run time. How this works is the customer develop a custom object that implements an interface called IBindingObject. The rules engine loads the object (using reflection), and verifies that it does indeed implement IBindingObject. We then use reflection to call other methods to find out and use the rule capabilities of the custom object.
HTH
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks guys. I am very new to this concept of reflection. and when i read abt it i was wondering how this could be used in real time apps. that is y i posted the msg. i got some idea now. thanks a lot.
|
|
|
|
|
hi i want to hide some of the nodes of the treeview based on some condition how can we implement that. There is no such property for a node to make invisible.
thanks.
|
|
|
|
|
There is no way to make a node invisible. You can remove the items you want to hide.
|
|
|
|
|
You could just override the DrawNode method, and based on a custom treenode tag or property, e.g IsInvisible, decide if the node must be drawn.
Diego Valdevino.
|
|
|
|
|
in my project i nedd the first root node invisible, my solution was stablishing margin-top:-30px, i tried finding on javascript but it didn't caught the css style neither the element.style.display="none" neither the element.style.visibility="hidden"
good luck
|
|
|
|
|
Hello,
I have a table with the primary key being a auto incremented value (IDNumber).
I need to retrieve the latest value that was inserted into the database.
So if the latest IDNumber is 100, I have to somehow pull this number from the database, so I can use it in my program.
The main problem is, if the program is first started I need to get this value.
I am using VS 2005 and SQL server 2005.
Is there a simple way to do this.
Thanks in advance,
Steve
|
|
|
|
|
fire a query which would fetch max of ur primary key column.
e.g.
Select Column1,Column2 FROM Table WHERE PrimaryKey = SELECT MAX(PrimaryKey) FROM Table
sameer
|
|
|
|
|
use IDENT_CURRENT( 'table_name' ) to get the last identity value generated for a specified table or view in any session and any scope.
Naveen G
MCSD.Net
|
|
|
|
|
Hi all,
I need to solve a problem for working with file in C#. I had a text file. It stores information of Customer. It is viewed:
Customer.txt
ID Name Address PhoneNO
1 Johnny Texax 1234567
2 Jackson NewYork 4562314
3 Bush LalsVG 4789633
4 Michael Maiami 7550751
.......................
Now, I want to add new Custmer into Customer.txt. But this Customer's ID is not the same Customer's ID exists in file. (the same ID in a table in database ).
Please help me!
Thanks!
|
|
|
|
|
You can read the text file as line by line and use the substring to spilt out ID from the string. use the following
<br />
File.ReadAllLines Method <br />
string[] s=String.Split (' ')<br />
then Compare every 3rd element in the array (s) ( C.ID) to check whether the CID is existing in the file or not.
Note : space delimit is important between the columns in the file
|
|
|
|