|
Hi there.
I'm fiddling around with arrays and i need to collapse (re-arrange) an array. Currently i have no clue how to do it, so if anyone could help out with a little example or some hints i would be thankful.
An example of what i want to do:
---------------------------------
An array containing 5 elements
1 - 2 - 3 - 4 - 5
If i remove element index 3 from the array i want the index of element 4 to change to 3 and the index of element 5 to chance to 4. How is this possible?
Thanks alot in advance!
|
|
|
|
|
Create a temp array, copy all the other elements to it, then assign the temp to the old array.
|
|
|
|
|
Take a look at the ArrayList.
|
|
|
|
|
I have a simple class:
public class Test
{
public Test()
{
}
public string name;
public int age;
}
and part of the code used in de/serialization:
Test c;
Test a = new Test("martinez", 21);
Test b = new Test("kate", 20);
TextWriter tw = new StreamWriter("c:/text.txt");
System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(typeof(Test));
ser.Serialize(tw,a);
ser.Serialize(tw,b);
tw.Close();
TextReader tr = new StreamReader("c:/text.txt");
c = (Test)ser.Deserialize(tr);
tr.Close();
And here pops an error
An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll
Additional information: There is an error in XML document (12, 3).
, why I can`t deserialize an object from that file?
Further question - may I keep different sort of objects in one file? If so, how to check if read object is the one I was looking for?
thank you for any help
|
|
|
|
|
Hi,
i have developed a user control, when i put the user control with a larger size from its originalone on a form, only the original size is shown, it is like when a picture is shown in a picturebox with property streach set to false.
I want to do streach the user control to the size it is on the form &
i want a lebel to be 8 pixel down fromits top no mater what is its size on the form (i want to control the locations of the internal control)
Can anyone help me
Regards,
Arus
|
|
|
|
|
hi
im trying to create a number of radiobutton in runtime.
int i = 0;<br />
while (TempString != null)<br />
{<br />
if (TempString.Length > 3) <br />
{<br />
RadioButton rbNew = new RadioButton ();<br />
rbNew.Name = (rbNew.Name.ToString() + i.ToString());<br />
rbNew.Text = TempString;<br />
rbNew.Visible = true;<br />
pnVSSProjects.Controls.Add(rbNew);<br />
<br />
}<br />
i++;<br />
<br />
}
but it only create the first RadioButton and not the others.
please help.
thanks
Have a nice Day
-- modified at 8:37 Wednesday 14th September, 2005
|
|
|
|
|
liqnit wrote:
RadioButton rbNew = new RadioButton ();
rbNew.Name = (rbNew.Name.ToString() + i.ToString());
rbNew.Text = TempString;
rbNew.Visible = true;
pnVSSProjects.Controls.Add(rbNew);
You're not setting the Top and Left properties of the controls you're creating to move them around the container they're in. This means that each one is being put in the exact same place, so the first one created is the only one you actually see. All the others are behind it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks
it's working great now
Have a nice Day
|
|
|
|
|
Hi All,
In my application User selects the file which is *.dll by browsing on the System. Now i want to find out this dll is .NET assembly or Com dll.
How should i find out the Dll is Managed dll or unmanaged dll programatically??
Thanks,
TusharM
|
|
|
|
|
Try to Load the dll file in a try catch block. You will recieve a System.BadImageFormatException
for unmanaged dll's.
try
{
Assembly.LoadFrom(@"C:\WINDOWS\acb.dll");
}
catch(System.BadImageFormatException ex)
{
MessageBox.Show(ex.Message);
}
catch ( Exception ex )
{
MessageBox.Show(ex.Message);
}
|
|
|
|
|
If i create a file or whatever can i give it a protected status?
Once thats done would it be possible to remove it as well?
|
|
|
|
|
What do you mean by "protected status"?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How, can I call an excel macro fom C#?
Thanks
|
|
|
|
|
do not know exact code for Excel but I just dug through simular
thing (only with MS Outlook ), you can use Interop to dig down all objects in Excel.
1. set referense in solution explorer to ms excel com library(COM tab).
2. get a handle of Excel namespace:
using nsExcel=Microsoft.Office.Interop.Excel;
from there to run a macro it is basicaly just the knowlege of Excel objects
and not much of c#.
|
|
|
|
|
Thank you
You are probably right what I need is know how to call an excel procedure from an external program
Regards
|
|
|
|
|
I want to put my referenced assemblies in a subfolder of \bin .. like \bin\assemblies. My application is in \bin.
By fefault .NET puts my app/assembly in same folder as my referenced assemblies. i use "Local Copy" of all references.
Is there a way to tell .NEt to use other locations?
//Maw
|
|
|
|
|
How to instantiate C# from Excel?
|
|
|
|
|
You don't! C# isn't a class, but a language.
Perhaps a more detailed explanation of the problem would help?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Create a COM component, then you can use it from an Excel macro.
|
|
|
|
|
Thank you
And How can I create a Com component in C#?
L.
|
|
|
|
|
There are a *lot* of tutorials about this on the web, search Google and MSDN and you'll find it. Probably you'll even find some sample that makes Excel communicate with a C# component.
|
|
|
|
|
hi,i want to make a voice chatting software
in C# can anyone tell me the road map that i should follow, i mean, that tbe things i should know first to develop such a software or what i should know to complete it efficientlly .thankx
|
|
|
|
|
PLzz give me quick response bc i am making project on operating system i choose java or C# for making the simulation of operating system and i want to make my project on linux
rana......linux
|
|
|
|
|
You might have easier to find tools for java on the linux platform, as C# is more of a Microsoft product.
Other than that it's more a question of taste. Personally, I like C# better, but I bet you don't have to look for long to find someone with the opposite opinion.
---
b { font-weight: normal; }
|
|
|
|
|
hi there
Aamir Rana wrote:
making the simulation of operating system
can u explain more here?
Aamir Rana wrote:
i want to make my project on linux
for me, java is supported better in linux env
<< >>
|
|
|
|