|
Wow -what a mess.
List<int> list = new List<int>();
while(list.Count < 20)
{
int n = randomObject.Next(10,101);
if (!list.Contains(n)) list.Add(n); // ! is Not in VB.NET
}
list.Sort();
That should do it in C#, hopefully you can follow my logic and impliment it in VB.NET.
|
|
|
|
|
Why not make the numbers sorted and without duplicates from the start?
List<int> list = new List<int>();
int count = 20, n = 10;
Random rnd = new Random();
while (count > 0) {
if (rnd.Next(101 - n) < count) {
list.Add(n);
count--;
}
n++;
}
---
b { font-weight: normal; }
|
|
|
|
|
Because that's harder to read ? :P Also, because I think it's worth pointing out that the container classes have methods like Sort, there's no need to be writing them.
|
|
|
|
|
I appriciate the thought, but C++ doesn't really help, I'm having a hard enough time trying to figure it out in VB.
Thank you though.
|
|
|
|
|
Hi
I can develop Muli-language projects in C# but in VB.net I cant. Please tell me exact method or an article that implement multi language...
Thanks
Syed Shahid Hussain
|
|
|
|
|
Hi All,
I am facing serious problem in vb.net multithreading .i am using dataset as shared variable but geeting error oject required .i am explaining in details .
i have defined one class ,in that difind one shared variable .calss having a function that called by timer thread and refereshing dataset every five minute .othere 60 thread concurrently access the dataset by filter and deleting the row from the dataset based on filter condition .but i am getting seriuos error null poiter exception object required continously . I tried synclock to avoid the error but after some days its starting again .
how can i resovled the problem if not then what is other solution .shall I use xml doc object .Is there any other object i can use instead of dataset .
please advised me .
-- modified at 12:33 Sunday 12th November, 2006
Jaseem Ahmad
Software Engineer ,
Mercator ,IT Division of Emirates group .
Deira Dubai.
|
|
|
|
|
n buddy is there to reply my question .
Jaseem Ahmad
Software Engineer ,
Mercator ,IT Division of Emirates group .
Deira Dubai.
|
|
|
|
|
Hey guys
Thx to codeproject Team...
if i have an array and wants to insert each field of that array in a DB
While k < arr.Length<br />
<br />
insert into table table.column values(k(0)...) ?<br />
k=k+1
how do i do this?
Regards
Ramy
|
|
|
|
|
Your code is on the right track, except you would use arr(k), not k(0).
---
b { font-weight: normal; }
|
|
|
|
|
I know that it is gonna sound a silly question, i m new in Sql:
Insert into employee (id,name) values (employyeeId,"ramy")
what should i replace employeeide with
note that employyeid is the primarykey of the table
and how this value increments?
Regards
Ramy
|
|
|
|
|
If the field employeeid is defined as an IDENTITY field then the numbering is taken care of by sql server - you just need to insert the other field...
e.g.
INSERT INTO Employee (name) VALUE ('ramy')
Then you can find out what the identity of the most recent field added in your code by using the IDENT_CURRENT('Employee') syntax.
|
|
|
|
|
Thx Ducan
issue solved
Regards
Ramy
|
|
|
|
|
Hi everyone,
I have a project in VC++ ,it is ClassLibrary project and it has a function that return jbyte *.
I would like to call this function in VB project ,how can I convert jbyte * to byte array ?
I would appreciated for any help .
If there is any document,sampe code or link for "type conversion between VC++ and VB.net "please inform me.
yours sincerely,
Orchid
|
|
|
|
|
What on earth is a jbyte ?
|
|
|
|
|
Hello,
I am a newbie.
I have read source code of many programs.
They contain some application forms.
I can't know which function is created for user interface or change file time.
I would like to see the easy code to change file time.(Any language C/C++ , Java , Or VB)
I would like to change file attribute
- created time
- last modified time
- last access time
Any one can help me?
Thank you.
..................
|
|
|
|
|
Have a look at the Ssytem.IO.FileInfo class.
---
b { font-weight: normal; }
|
|
|
|
|
Hey guys
I need a simple code :
if i want the cursor to be on : X=20, y =30 the cursor goes to this location (x,y= varible pixles)
how can be this done?
Regards
Ramy
|
|
|
|
|
This should work:
Cursor.Position = New Point(Cursor.Position.X = 20, Cursor.Position.Y = 30)
|
|
|
|
|
When i apply this instruction ,it returns always x=0 and y=0 for cursor position
Cursor.Position = New Point(Cursor.Position.X = 20, Cursor.Position.Y = 30) ,
the error given in cursor position is:qualifying expression will not be evaluated
Regards
Ramy
|
|
|
|
|
Are you using VB6 or VB 2005?
|
|
|
|
|
using VB.net 2005
the matter is to i want to move the cursor to a place that i want....
ex: x=20 y=40
and the next step that i want to do :
is to change the color of the pixels there (means X=20,21,...30 and Y=40,41....)
thx
Regards
Ramy
|
|
|
|
|
Hi
on the design mode I can make the program with multi language, by languange properties ,
but how I can allow the user to change the language on Run mode ??
so thanks to any one try to help me >>
jooooo
|
|
|
|
|
There's no kind programmer here
any body response me
jooooo
|
|
|
|
|
as no one reply I try to answer
You change the current language by changing culture
no exact but take a try
System.Threading.Thread.Currentculture.....("here language name")
Sorry if it doesn't work. By the way I am also trying to search on it.
Take care
Syed Shahid Hussain
|
|
|
|
|