|
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
|
|
|
|
|
So how is it if datagrid of windows application?
|
|
|
|
|
Hey everyone. I've been out of the programming world for a number of years and would like to upgrade my knowledge. I don't need tutorials regarding how to program, per se, but rather an overview of the strengths/weaknesses of the differing languages.
I'm new to the whole .net and C# world but have a strong understanding of programming principles and language structures, etc. I've worked with MFC in older versions of Visual Studio, although only in C++. I havn't touched VB since the mid '90s but if it has improved I'm not adverse to giving it another try.
Where should I go to find good overviews of .net and C#, as well as changes to the visual studio interface?
Thanks - mutty
|
|
|
|
|
|
|
Hello Everybody:
In somewhere I read that with the tool cl.exe that comes with .NET Framework 1.1 is possible to compile standar C or C++ code.
So I tried to compile the classical example code.
Lets name it as hello.c.
Here it is the content of the source:
------------------------
#include <stdio.h>
int main(void)
{
printf("Hello\n");
return 0;
}
-------------------------
But when I enter in the command line:
F:\>cl hello.c
This is what I see on console:
---------------------------------------------------------------------
Microsoft (R) 32-bit C/C++ Standard Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved
hello.c
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
/out:hello.exe
hello.obj
LINK : fatal error LNK1104: cannot open file 'LIBC.lib'
------------------------------------------------------------------------
Thats all!: I got only the object file but not the executable.
I checked that LIBC.lib does exist in F:\Archivos de programa\Microsft Visual Studio .NET 2003\Vc7\lib and my LIB enviroment variable is set to that PATH.
Somebody could tell me what I am doing wrong?
Am I missing something?
I will appreciate any help.
tejasbill
|
|
|
|