|
Ok sounds like a good plan to me, I'll use that thanks.
|
|
|
|
|
(Be gentle, I'm a .Net newbie)
How do I parse an XML string to a DOM tree? My gut says use a variant of an XMLReader so I thought I'd give XMLTextReader a try by giving it a Stream created from my string , but I don't know how to do that, so I'm probably barking up the wrong tree. I was hoping I could use BufferedStream ...
Thanks!
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Looks like I may need to use XmlDocument.LoadXml() ...
[edit]
Yep - that was it!
[/edit]
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hey PPL
I mad a homepage using the new asp.net 2.0 controles and all my users are stored in a SQLExpress db files connected with the SQLMembershipProvider.
Is there any way to use this Provider from a windows application ?? I made a reference to System.Web.Security, where it's located and i can make a new class like System.Web.Security.SqlMembershipProvider mp = new System.Web.Security.SqlMembershipProvider(); but that's pretty much it. I cannot find any way configurer it like in the web.config file. Any idears ?
Thx in Advance
|
|
|
|
|
I am looking for a way to drag-drop regions inside a Panel.
Can somebody please point me to the right direction.
|
|
|
|
|
Hello, I want to call a method which accepts an array. I've defined an array (originalArray) and want work with it within the method CheckArray. But if I change something within the array inside the method, the original array will be modified too. I thought the parameters are ByValue automatically? Isn't it?
Thanks in advance for every tip.
private void button4_Click(object sender, System.EventArgs e)<br />
{<br />
CheckArray(originalArray);<br />
}<br />
<br />
private void CheckArray(int[,] iArray)<br />
{<br />
int[,] copyArray = iArray;<br />
copyArray[0,0] = 0;<br />
}
|
|
|
|
|
Seraphin wrote: Hello, I want to call a method which accepts an array. I've defined an array (originalArray) and want work with it within the method CheckArray. But if I change something within the array inside the method, the original array will be modified too. I thought the parameters are ByValue automatically? Isn't it?
Yes. But...
private void button4_Click(object sender, System.EventArgs e)
{
CheckArray(originalArray);
}
private void CheckArray(int[,] iArray)
{
int[,] copyArray = iArray;
copyArray[0,0] = 0;
}
You've not copied the array, you've only created another reference to the same array. When you assign a value to the array using the copied reference, the original array is affected, too. iArray and copyArray both reference the same array.
Remember, iArray is just a reference to an array held somewhere in memory. References are just variables. The reference is passed by value so that if you did something like this:
private void button4_Click(object sender, System.EventArgs e)
{
CheckArray(originalArray);
}
private void CheckArray(int[,] iArray)
{
iArray = new int[10, 10];
iArray[0, 0] = 0;
}
The originalArray will not be affected. You've only changed the iArray variable, which has local scope within the method.
To copy the array, you have to create a new array, not just a new reference, and copy the contents of the old array into the new array. Unfortunately, the CopyTo method only works for one-dimensional arrays, so you may have to write code that does the copying by hand. Or maybe someone else knows of a better way.
|
|
|
|
|
Thx, but what "ref" stands for, if you use it in a parameter list? If its just a reference, why I should use "ref"? I've read that ByValue is the standard, so I am confused ...
|
|
|
|
|
Hmm, I thought I had replied to this post, but it's not showing up. Here is the second attempt (good thing I had my answer saved).
Say I did this:
private void button4_Click(object sender, System.EventArgs e)
{
CheckArray(ref originalArray);
}
private void CheckArray(ref int[,] iArray)
{
iArray = new int[10, 10];
iArray[0, 0] = 0;
}
This will actually change the originalArray variable. It now points to the new array I created in the CheckArray method. Without the ref modifier, it would only change the local iArray variable.
A reference is a variable that points to some object in memory. The originalArray variable is a reference to an array held in memory somewhere. It allows me to perform operations on the array. However, operations on the originalArray variable itself only effect that variable. For example:
int[] arrayA = new int[10];
int[] arrayB = arrayA;
arrayA[0] = 42;
arrayA = null;
Console.WriteLine(arrayB[0]);
When a reference variable is passed by value to a method, a copy of the reference variable itself is made, much like what I did above with the arrayB variable. You'll notice that when I nulled out the arrayA , it did not affect the arrayB variable. It's the same when you pass a reference by value to a method. operations on the reference variable itself only affect the local variable.
Now, the ref keyword gives me a reference to a reference, so to speak. If I modify a parameter with ref , and perform operations that change the variable itself, it also affects the reference variable that was originally passed to the method.
This takes awhile to wrap your mind around it, but keep at it and it will eventually make sense.
|
|
|
|
|
Right, so i'm using direct x to play some music - easy right?
Well anyway, i add in the reference and what not and it all works, but i go to a different computer which i havn't installed the sdk, and obviously it doesn't work.
So.
If i go get the dll files and supply it with the app, then put the refference on them, would that work?
Or do i actually need to have the sdk installed?
If so, how do i get it to work without the user having to download and install the sdk?
ps. what exactly does the DirectX redistributable do? It doesnt let me run the app.
|
|
|
|
|
The Undefeated wrote: ps. what exactly does the DirectX redistributable do? It doesnt let me run the app.
It should do, so long as it's the right one. Your app should probably have some DirectX dlls to install with it as well, when you reference them, do you set your project up to copy them to the local directory ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I had a similar issue. After installing the VS2005 Pro as well as the VS2005 C++ express, I got a package load error each time I started VS2005 pro OR the vs2005 C++ express editon. I uninstalled and reinstalled several times and got the same result. I also tried using the uninstall exectutable from Microsoft to no avail.
Finally I took the following steps:
1. uninstalled EVERYTHING that had to do with Visual Studio, and .NET components (2.0, 1.1, 1.0), SQL Server and MSDN, MSXML. I mean everything. I followed the uninstall directions given in the dialog after uninstalling Visual Studio and removed/uninstalled the items in the order specified.
2. Then I went to the WINDOWS\assembly directory and deleted EVERYTHING under that directory.
3. I went to "Program Files" directory and deleted everything that had to do with Visual Studio and .NET (2.0, 1.1, 1.0) and SQL Server and MSDN.
4. I also went to the following directories and deleted everything and all directories that had to Visual Studio, SQL Server, MSDN and .NET (2.0, 1.1, 1.0)
"Documents and Settings\<username>\Application Data\Microsoft"
"Documents and Settings\<username>\Local Settings\Application Data\assembly"
"Documents and Settings\<username>\Local Settings\Application Data\Microsoft"
5. Finally I deleted all tempory files in all temporary directories and cleared the internet cache and temporary files using IE
6. I also went to "My Documents" and deleted the Visual Studio stuff there.
After all that I reinstalled VS2005 Pro and VS2005 C++ express and I no longer get the errors.
|
|
|
|
|
When rendering a string onto a Graphics, on can specify a StringFormat. The StringFormat object has propery named "Trimming". Using this feature a string that doesn't fits into a region is trimmed.
How can this be achived with a label. How can I make a label's to trim it's text?
I hope I understand...because is a rough world out there...
|
|
|
|
|
When you put text in a label doesnt it just get cut off if it doesnt fit anyway?
Or am i just confused about stuff
|
|
|
|
|
It does get cut off, meaning that what it doesn't fit it's not rendered, but the trimming method offers a way of informing the user that the text didn't fit it's area by inserting a "..." string at the end of the visible text.
I hope we understand...because is a rough world out there...
|
|
|
|
|
I kind of resoved the problem in a "manual" way : implementing my own Pain method - work's fine for what i neaded the functionality.
I hope you understand...because is a rough world out there...
|
|
|
|
|
Aww, dammit, worked out this for nothing, well i'll post it anyway, and then well, whatever:
string labeltext = this.label1.Text;<br />
int length = labeltext.Length;<br />
<br />
if(length > 35)<br />
{<br />
labeltext = labeltext.Remove(32, length - 32) + "...";<br />
}<br />
<br />
this.label1.Text = labeltext;
that number there, yeah 35 thats the one, that should be however many characters that fit into your label, and then the second number (32) should be your first number minus 3 so that the "..." fits.
And if you want to keep the original text, just save it as a different string.
Well i'm outa here ##----------------------------->>
|
|
|
|
|
Unless you've replaced the default font with a fixed width one this isn't a good implementation since some characters are wider than others and you maximum char count won't be fixed. The proper way to do this would be via the use of Graphics.MeasureString(...)
|
|
|
|
|
Hello,
I am trying to export a datagrid to excel, I have two basic foreach statements:
<br />
int rowIndex=0;<br />
<br />
<br />
foreach(DataRowView row in dataview) { <br />
rowIndex++; <br />
ColumnIndex=0; <br />
<br />
<br />
foreach(DataColumn col in dataview.Table.Columns) {<br />
ColumnIndex++; <br />
if (ColumnIndex > 3) { <br />
theRange = (Microsoft.Office.Interop.Excel.Range)excel.Cells[rowIndex+1,ColumnIndex-3];<br />
theRange.Font.Name = "Arial";<br />
theRange.Font.Size = 8;<br />
<br />
} <br />
}
}
Any ideas why it is so slow.
Thank you very much.
|
|
|
|
|
It appears to me that your foreach statements are incorrect. You start off looking at each row of the dataview.
<i>foreach(Dataview row in dataview)</i>
Then you loop through each colomn in the davaview
<i>foreach(DataColumn col in dataview.Table.Columns)</i>
/*
* Change this to look at each Column in that row rather
* than the entire table.
*/
Then you move onto next row.
What I see going on here is that your reading each column for every row in the dataview.
|
|
|
|
|
To be more precise, I should change the inner foreach loop which loops through the columns, to something like:
for (int i = 0; i < Columns.Count; i++) {.......};
I guess like that it should b e a bit faster.
Will try it.
Thank you.
|
|
|
|
|
Hi all,
I'll be teaching C# in a school and my audience is quite young(~14-17) so I wanted to ask you what do you think would be the best book I could follow to make them really get into C#? Any suggestions are appreciated.
Regards
|
|
|
|
|
Hi,
I doing an app in winforms. I have groupboxes with few checkboxes or radiobuttons. How do I get the value of selected control from each groupbox.
Thanks.
|
|
|
|
|
The data isn't stored in the groupbox at all. You need to examine the checked property of each control seperately.
|
|
|
|
|
Is it possible to hide any public method or public property of the base class when inheriting that class.
If yes, then how?
Infact I am creating a custom control by inheriting a ScrollableControl and I don't want to show the AutoScroll property to user of my control (developer).
Thanks
-- modified at 12:39 Thursday 10th November, 2005
|
|
|
|