|
how to send files(eg powerpoint slides) from server to client
|
|
|
|
|
I am having some very strange problems with ArrayList in a class I've written. When I create and populate an ArrayList, only the odd indexes are populated, and the evens are no where to be found. When I try to iterate through the list, it fails on the first index with an "Object not set to an instance" error (since index 0 is technically even). If I start on index 1, it succeeds, but fails when it gets to index 2.
When I watch the ArrayList in VS.NET's debugger, I get a list like this:
list - {Count(5)}
[1] - object 0
[3] - object 1
[5] - object 2
[7] - object 3
[9] - object 4
When it should be this:
list - {Count(5)}
[0] - object 0
[1] - object 1
[2] - object 2
[3] - object 3
[4] - object 4
Has anyone ever encountered something like this before? Any ideas what could possibly be causing such odd behavior with the ArrayList object? Thanks for any help.
|
|
|
|
|
Without seeing your source I can't say for certain, but at a guess you're incrementing the index you add at both before and after you insert an element into the array.
|
|
|
|
|
How are you populating the ArrayList? Using the constructor that takes an ICollection as parameter?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
ArrayList list = new ArrayList();
foreach (obj in objectarray)
{
list.Add(obj);
}
return list;
Thats basically it. I'm not doing anything special, or out of the ordinary. I'm just using the arraylist at its most basic level.
|
|
|
|
|
Very strange. What exception do you get when you try to access index 0?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
From the c# programmer's reference:
The foreach statement repeats a group of embedded statements for each
element in an array or an object collection. The foreach statement is used to
iterate through the collection to get the desired information, but should not
be used to change the contents of the collection to avoid unpredictable side
effects. The statement takes the following form.....
If you change the collection, the iterator is no longer valid.
[the first time I posted this, I accidentally replied to S. Senthil Kumar. sorry for the mistake]
[P.S. I actually did reply to Jon Rista this time, but it still shows as a reply to S. Senthil Kumar. I don't know what I can do.]
|
|
|
|
|
Well that's true, but he is iterating over an object array and is changing the newly created ArrayList so this shouldn't be the problem...
|
|
|
|
|
Sorry, I must have read what I thought he was saying rather than than the actual code. I'll have to get these glasses checked!
|
|
|
|
|
Is it possible the the objectarray contains null values?
Try this:
ArrayList list = new ArrayList();
foreach (obj in objectarray)
{
if (obj != null)
list.Add(obj);
}
|
|
|
|
|
Even in that case, he should be getting null values when he indexes into the array, not exceptions.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
That's right, but I assume he didn't just iterate but also tried to call some method on those elements.
|
|
|
|
|
There were nulls in the arraylist. I was populating it by traversing a RedBlack Tree (similar to a B-Tree), and I forgot to check for the nil nodes. Once I added the check for nil nodes in, the problem was solved.
I guess that if you add nulls to an ArrayList, adding a watch on that ArrayList will only show the non-null components. The thing that I still don't understand is why I keept getting an exception when I tried to retrieve the elements. Even if the element was null at a given index, I should get a null result, not an exception. Regardless, the problem is solved now. Thanks for all the replies.
|
|
|
|
|
Ok, i have finished my project. i wanna send it to a friend. what do i do. with visual studio 6, there was (make exe file). how do u do that with .net?
thanx in advance.
|
|
|
|
|
|
and where do i find that?
|
|
|
|
|
|
|
Hi,
Please help me it is urgent.
there is only .Net Framework and crystal controls are installed on web server and when i am trying to run following code on server it gives error of Logon Failed.
I face a strange error of Logon failed when i would apply following code to Crystal Engine.
I provide following code for make connection to report.
********************************************************
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
For Each tbCurrent In Session("Report").Database.Tables
tliCurrent = tbCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
.ServerName = ConfigurationSettings.AppSettings("strServerName")
.UserID = ConfigurationSettings.AppSettings("strUserID")
.Password = ConfigurationSettings.AppSettings("strPassword")
End With
tbCurrent.ApplyLogOnInfo(tliCurrent)
Next tbCurrent
**********************************************************
Please Help me .
If there is other alternative for applying Connections to crystal report then please help me.
when i apply same code to server when whole .net studio installed it works fine.
I am using OleDB Connections for Oralce for your kind information.
So i want to know which crystal decisions files are installed when we install only .Net framework on server.
Thanx.
Parimal Patel
(S/W Developer)
Parimal Patel
(S/W Developer)
|
|
|
|
|
What is the use of MarshalByVal?
How to use that?
|
|
|
|
|
|
Hi,
Can anyone provide me code for accessing different versions of assembly in GAC at runtime through Reflection. Is it possible in any other way.. Please let me know..
Thanks
|
|
|
|
|
So I have a remoting program (service) running under a Windows Service at the server. This service in time needs to latebind to another assembly in the server machine.
On the other side sits the client application: this is a Web Application that needs to connect to the service (not a WebService) to obtain TRUE/FALSE generated by the the latebound assembly in the server.
When we run the thing we get a Remoting Exception error telling "Server error...blah, blah,...unknown remoting error" really not much to hold on to.
MORE INFO
The user of a Web App are of course ANONIMOUS, that means we don't have credentials for any of them, so we set "Authentication" to NONE in the client.
|
|
|
|
|
I am generating the columns of datagrid with auto generate column is true.I want to make only one column as hyperlink.How can i do that in vs.I am using vb.net
Thanx in anticipation
Take it easy...
|
|
|
|
|
Hi tayyab_mit,
One method is you can write code in datagrid itemdatabound event handler.
There you can create a hyperlink control and can set its text and link.
Finally add the hyperlink control to the datagrid column.
(this is c# code, make changes accordingly)
if( e.Item.ItemType == ListItemType.Item e.Item.ItemType == ListItemType.AlternatingItem )
{
HyperLink hlc = new HyperLink();
hlc.NavigateUrl = "http://www.codeproject.com";
hlc.Text = "codeproject";
//finally we add the created control to datagrid cell control collection
e.Item.Cells[0].Controls.Add(hlc);
}
charmis
|
|
|
|