|
What dou you mean with the "best way" ?
If you have the object, the best way is Remove(object obj);
If you have the index, the best way is Remove(int index);
|
|
|
|
|
RemoveAt(int Index) faster, look at the following code of Remove(object Obj):
<br />
public virtual void Remove(object obj)<br />
{<br />
int num1 = this.IndexOf(obj);<br />
if (num1 >= 0)<br />
{<br />
this.RemoveAt(num1);<br />
}<br />
}<br />
As you can see Remove(object obj) actually calls to RemoveAt(int Index)
|
|
|
|
|
|
RemoveAt() is safer in case the ArrayList contains duplicate objects.
/ravi
|
|
|
|
|
Hello I have a CSV file which contains matters like
"Title","First Name","Last Name","Address","City"
"Mr.","Yogee","Talokar","007,A-Wing,M.G road","Pune"
"","Radhika","Talokar","007,A-Wing,M.G road","" etc.
I wana to split it & seperate First Name,Last Name,Address,City etc,.
I tryed it by using delimiter ","
but it also split "007,A-Wing,M.G road" like
007
A-Wing
M.G road
I dont want to split "007,A-Wing,M.G road" ,bcos I have to count no. of strings.
is there is any other way to split it Like
"Yogee""Talokar""007,A-Wing,M.G road"
"Radhika""Talokar""007,A-Wing,M.G road"
-- modified at 5:59 Friday 28th July, 2006
Yogesh_T
|
|
|
|
|
Why don't split it by "," ?
Then you will have an array like:
"Mr.
Yogee
Talokar
007,A-Wing,M.G road
Pune"
Now you only have to delete the first and last " and you're finished. or if you want to add the " , you can simply add them to every one of them (except for the first and the last one) in the beginning and the end of the string.
|
|
|
|
|
is there any way to split by string like ", not by char ,
Yogesh_T
|
|
|
|
|
You can use the string.Split(string[] seperator, StringSplitOptions options) version of split. Use StringSplitOptions.None in the second parameter, and in the first parameter you put you delimiter.
|
|
|
|
|
You have used the wrong delimiter. That means in your text, you must write something but not delimiter. Just take another delimiter, like ";".
|
|
|
|
|
I use this regex:
Regex regExp = new Regex(",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))");
|
|
|
|
|
Hello Sir Its nice one ,Its working properly.
Thanks for this.
but I am unable to understand this code ,could u plz explain it or give me site referance for this.
bcoz I have a file like
"G.H.",,"","","",,,"Company Friend
Office
Lute
",,,,"Normal","False",,,"Normal"
//my code is
StreamReader r=File.OpenText(file_location);
strUserInfo = r.ReadLine();
if( strUserInfo != null)
{
Regex reg = new Regex(",(?=(?:[^\"]*\"[^\"]*\"])*(?![^\"]*\"))");
string[] split = reg.Split(strUserInfo);
//code
}
in this it read above code as 5 lines(in CSV file it seperate "notes" field) but it should be only one line,what should I do for this?
Thank you again
-- modified at 4:00 Wednesday 2nd August, 2006
Yogesh_T
|
|
|
|
|
Hi there - hope someone can help with this
I've read a little about impersonating users in .Net, but is it possible to impersonate a different PC?
In other words, is it possible to make it look like I am logged in on "PC 1" when actually I am logged in on "PC 2"?
Cheers!
Baz
P.S. I know this sounds kinda dodgy - but it's not at all!!! I do have a legitimate reason for wanting to know this info!!!
|
|
|
|
|
Baz wrote: I do have a legitimate reason for wanting to know this info
Such as?
|
|
|
|
|
I noticed that when the XP visual styles are on, the Panel control sometimes adds a horizontal scroll bar when it is not necessary. The controls in the Panel fit the visible area fine (including the scroll margin and vertical scroll bar). This does not happen when the visual styles are off, i.e. in the Windows classic style ! It doesn't matter if the AutoScroll property is set to true or false.
To fix this problem I wanted to hide the horizontal scroll bar manually. I tried to use the HScroll property. The MSDN documentation on the ScrollableControl (from which Panel is derived) class says:
"To manually override which scroll bars are visible, set the VScroll and HScroll properties. If either property is set to false, the corresponding scroll bar is not visible, even if the AutoScroll property is set to true."
This simply isn't true . You can set the property HScroll to false, but the horizontal scroll bar is still there and remains functional. The method SetScrollState doesn't work either.
Does anyone know how I can suppress a horizontal scroll bar in a panel?
Thanks.
|
|
|
|
|
I still haven't been able to suppress the scroll bar. The panel totally ignores the property HScroll and other scroll bar methods . However, I can now hide the scroll bar using the Interop function ShowScrollBar, although it doesn't prevent the scroll bar to appear briefly.
|
|
|
|
|
Could I get an example of how to do this, I have never used Interop before.
|
|
|
|
|
Can i do this??, i make a pdf with php library but can i open it from c# application?,How can i do? thanks for all
Dios creo un equipo perfecto a los demas los lleno de extranjeros
|
|
|
|
|
I want to upload video files throguh my ASP.Net application. Want to save uploaded videi files in project folder and path of video in database.
Saurabh
|
|
|
|
|
Have you ever heard of GOOGLE ???
|
|
|
|
|
Ya, I have heared about google. But I feel in place of google your specific advice can help me better to solve the problem
Saurabh
|
|
|
|
|
google can sometimes give you answers to your questions and good advice - try to help yourself before expecting others to take their own time to help you
cje
|
|
|
|
|
Hi,
I have launched a new thread for diaplying a modal dialog.
When i recieve an event to close the thread How can I close the dialog.
I have aborted the thread which holds the dialog. But this closes the dialog improperly. I want to close the dialog and the closes its resources manully when i need to close the thread.
Cheers.
Mursil
|
|
|
|
|
Cardinal programming sin #1 is operating on the UI from anything but the (single) UI Thread.
You just discovered why!
Open your dialog on the UI Thread, only operate on it from the UI Thread.
|
|
|
|
|
I have the following hierarchy:
Class a{
int x=0;
}
Class b:a{
int y=0;
}
Class c:b{
int z=0;
}
I'd like to be able to use the Type.GetFields() on an instance of class
C and see the field declared not only on the class, but the inherited
fields as well. I've tried the FlattenHierarchy, NonPublic, and
Instance binding flags (and others), but none of them cause GetFields
to return anything other than a single field for an instance of class
C. If I declare the fields on the superclasses public, it works. What
am I doing wrong?
Thanks,
Jonathan
|
|
|
|
|
The quickest answer to your question, is to create a construtor in your third class and then within it type this. and see what intellisense shows. You will only see the integer within class C.
If you want all inheriting classes to have access to the those integers then this is what you need:
namespace TestInheritance
{
public class A
{
internal int one;
}
public class B : A
{
internal int two;
}
public class C : B
{
int three;
public C()
{
}
}
}
Now when you type this. intellisense will show all three variables. You should also be able to retrieve then generically now with Reflection.
|
|
|
|
|