|
Talal Sultan wrote: Would it still be more efficient to split the remainder and take the first element?
That would create another array, so it would not be any more efficient.
---
single minded; short sighted; long gone;
|
|
|
|
|
Brilliant, I completely missed this, I thought I was going the long way about it.
Thanks.
Sean
|
|
|
|
|
Actually, you have to go the long way about it.
---
single minded; short sighted; long gone;
|
|
|
|
|
You can't resize an array in .NET. If you want an array of different size, you have to create a new array.
You can do it a bit more efficiently, though, by only creating a new array if the size actually is larger than the desired.
int count = dt.Columns.Count;
string[] tempRowIn = finalLine.Split(',');
if (IgnoreExtraLines && tempRowIn.Length > count) {
string[] tempRowOut = new string[count];
Array.Copy(tempRowIn, tempRowOut, count);
tempRowIn = tempRowOut;
}
row.ItemArray = tempRowIn;
---
single minded; short sighted; long gone;
|
|
|
|
|
Or you can call Array.Resize method but surprisingly a new array is allocated even if new size is less then old size
|
|
|
|
|
I have a com component developed in .Net. I consume this component from client through In Proc Server implementation. Is is possible to load this component in seperate appdomain? If yes, then how i can make calls to specific methods of com component from client?
Hope my question is clear. If not pls revert for more details.
Thanks.
|
|
|
|
|
Can any body help me out how to make a window as transperant window in .net2.0;
|
|
|
|
|
try setting the opacity property for the window...
HTH.
|
|
|
|
|
Actually my requirement is to display only the text which is present on the form without showing the form to the user.If i tries with opacity it is showing nothing.Everything becomes transperant.
|
|
|
|
|
don't put the text on the form as lable or something. instead paint the text using DrawText in OnPaint.
I'm not sure it will work or not. but you can try.
HTH.
|
|
|
|
|
Hello,
Set the "TransparencyKey" property equal to your forms BackColor.
All the best,
Martin
|
|
|
|
|
Hi Martin,
your idea is good bt here my forms backcolot is changing dynamically.How i can implement this one with tansperancykeycolor property.
|
|
|
|
|
Hello,
RameshwerE wrote: your idea is good
RameshwerE wrote: my forms backcolot is changing dynamically
You have to handle the BackColorChanged event and set it there accordingly.
this.BackColorChanged += new System.EventHandler(this.yourForm_BackColorChanged);
private void yourForm_BackColorChanged(object sender, System.EventArgs e)
{
this.TransparencyKey = this.BackColor;
}
Hope it helps!
All the best,
Martin
|
|
|
|
|
hello !!
Actually m a fresher n i have no idea what to do n which tech to get into . I hv got to work on java but in java i know nothing except core java . My Intereset is in >net n m not at all suer what to do plz do reply n hlp me out of dilemma
Mrinal
Mrinal
|
|
|
|
|
Please don't cross post. If I do a search on your user am I going to find lots and lots of posts asking the same question? If so, remove the ones that have no replies attached to them.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Could you at least make the effort of writing in correct English please?! As far as I know, we are not limited by the number of characters in a post and NO, writing in SMS format is NOT cool!
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"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."
--Rich Cook
|
|
|
|
|
|
Dear Mrinal,
here are the letters that seem to be broken on your keyboard.
Please insert them in the correct places using copy&paste and then try re-posting your question, so that people are able to read it properly.
I', a, d, a, d, n, o, l, o, g, y, a, e, ., a, d, I', ., e, a, e, a, d, e, .
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
|
Hi All,
PLease let me know if how can a save the values in a column from a database in an array using C# .NET Web Application (so that i could use each value in the array in my code one by one.)
For Eg.: if i have the following query:
SELECT Name FROM Details WHERE Country='India'
here "Name" and "Country" are two columns in table called "Details".
Suppose the query returns Three values: Ram, John and Sohail
i want these names to be saved in an arraay.
i could not use the "ExecuteScalar" class as it can save only one value into a variable!
please send me the few lines of code necessary to do that using the above mentioned example.
Thanks,
Ramesh
|
|
|
|
|
The SELECT command will already return the values in a table format. You need a data reader to loop through the values. You have to create your own DataTable (in this case with one column) and insert the values as you loop the data reader. If you are using SQL Server, you can use the SqlDataReader class.
Assuming you have:
sql command: SqlCommand myCommand = new SqlCommand();
data table: DataTable myTable = new DataTable();
You would have to put something like this
SqlDataReader dr = myCommand.ExecuteReader();
while (dr.Read())
{
DataRow row = myTable.NewRow();
row[0] = dr.GetString(0);
row[1] = ......
myTable.Rows.Add(row);
}
dr.Close();
Good luck
Talal
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"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."
--Rich Cook
|
|
|
|
|
Instead of manually adding each row to the datatable you can use dataadapter to fetch all the values
|
|
|
|
|
Thanks Talal
Now how do i get these values from row and save in a array variable, which i need to pass as a parameter to a method???
|
|
|
|
|
Like I said in my second post here http://www.codeproject.com/script/comments/forums.asp?msg=2176578&forumid=1649#xx2176578xx[^], you need to replace the data table stuff with the array stuff. Since you only return one column from the database, you would only need column 0 of the data reader:
ArrayList myList = new ArrayList();
SqlDataReader dr = myCommand.ExecuteReader();
while (dr.Read())
myList.Add(dr.GetString(0));
dr.Close();
If your method has an Array parameter, you can convert ArrayList into Array as follows:
Array myArray = myList.ToArray();
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"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."
--Rich Cook
|
|
|
|
|
Thanks talal
Now if i wanna display all these values in the array(or datareader) in a dropdown list.... how do i do that???????
|
|
|
|