|
Declare the ArrayList outside the method.
Example:
public ArrayList MyArrayList;
private void button2_Click(object sender, EventArgs e)
{
MyArrayList1 = new ArrayList();
}
You need to read more on variable scope.
Regards,
Bhupesh.
|
|
|
|
|
Hi, can anyone help me with the following:
When I use mage to create a clickonce deployment of a program called "TestClickOnce", said program will install directly from the created TestClickOnce.application manifest on the hard drive, but will not install from the web, nor will it update. The error is "+ Downloading http://localhost/installer/1.0.0.3/TestClickOnce.exe did not succeed. + The operation has timed out". Also "System.Deployment.Application.DeploymentDownloadException (Unknown subtype)" although the file does definitely exist...
When I create the deployment from within visual studio, it works fine. Publishing from Visual Studio however also produces the files setup.exe, TestClickOnce_1_0_0_0.application (as well as TestClickOnce.application) and also TestClickOnce.exe.deploy (and also a webpage, but I figure that is not important). Apparently the TestClickOnce.csproj file in the project is also modified by publish in visual studio. What are these extra files, how are they useful? Are they important and if not why are they there? Is it in fact the case that I have to publish it first using msbuild or from within visual studio and only use mage for creating updates? Except only the web stuff does not work....
If anyone can answer any of these questions, provide links to answers or suggest a suitable forum on which to ask them again I would be grateful.
I would also be interseted in finding out more of the intimate details on how ClickOnce works. So far I have only managed to find general information and repeats of the basic how-tos in the MS documentation.
|
|
|
|
|
I wana make sth (pic) to move randomly..
when the setting time gone .. i wana stop working that!
With x , y or anthing ?
pls find out some symbol codes for me .. if u know how to work wth..
i ld be really appreciated!
|
|
|
|
|
Could you rewrite your question in English, so one can understand you?
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hello
I have an object, Car which contains an object, Engine as one of its members. I have a collection of Car objects and I want to bind a drop down list to the collection, displaying a property of the contained Engine object:
class Car
{
public Engine engine;
public string manufacturer;
}
class Engine
{
public int capacity;
}
In my code I create a Cars collection:
Cars cars = new Cars();
I add my car objects to the collection and bind my collection to a drop doown list:
myDropDownList.DataSource = cars;
myDropDownList.DataValueField = "engine.capacity";
myDropDownList.DataTextField = "engine.capacity";
myDropDownList.DataBind();
This doesn't work though because the fields won't accept the syntax I use to specify the contained object's member.
On the other hand, this works fine:
myDropDownList.DataSource = cars;
myDropDownList.DataValueField = "manufacturer";
myDropDownList.DataTextField = "manufacturer";
myDropDownList.DataBind();
Can anyone tell me how to get my drop down list to bind so that I can display the contained object's member?
Thanks
|
|
|
|
|
Hello
Could you provide the code for the Collection class Cars? This would make it easier to help you.
Kind Regards,
John Petersen
|
|
|
|
|
I was wondering if you are creating a socket by using this code:
Socket socket_ = new Socket(AddressFamily.InterNetwork,SocketType.Dgram,ProtocolType.Udp);
what sort of data will you receive? will you get only the UDP portion of the IP packet? or will you get all ip packets with the upperprotocol matching UDP on the port you specified in your IPEndPoint? I'm trying to figure out where i go next in my code. if i need to write code to parse out the udp datagram from the ip packet or the data from the udp datagram. thanks!
|
|
|
|
|
nevermind. i used
BytesReceived = so2.EndReceive(ar);
System.Console.WriteLine("Bytes Received:" + BytesReceived);
and then matched up that number with the data bytes field in the UDP packet in ethereal. i think i made the logical assumption that bytes received: 282 and the length of the data in the udp packet in ethereal is 282 that its one in the same..
|
|
|
|
|
hi,
C# question
I am trying to understand events when used with a DLL file.
I can understand how to write a standalong event handler. But how do you
do event handling when faced with "talking" to a dll which takes care of the event handling?
Here is the situation.
I am writing a wrapper class.
MyClass ---> App.DLL
App.DLL already implements events:
Event1, Event2.
When i open the object browser this is what i see
event App.handleEvent1 Event1
event App.handleEvent2 Event2
The question is how do i implement event handling for event1 and event2 in MyClass?
Appreciate your help in advance.
thanks
Ramesh
|
|
|
|
|
No, you can't. The event model does not propogate events across the boundary of assemblies (DLLs). Callback could be a workaround, but it has some design issues and limitations in your case. By callback, I mean that after the DLL handles event1, make a callback into MyClass object for further processing.
Best,
Jun
|
|
|
|
|
I'm looking to declare an array but I don't know the # of elements I will need. It will be used in a "FOR" loop to read data from a database and I have no clue how many rows will be returned.
So for example, I want to declare my array like the following:
int[] myArray = new int[];
However, it appears I have to declare it with a default value like this:
int[] myArray = new int[3];
So what do I do if I don't know how many elements I will need?
Thanks.
-Goalie35
|
|
|
|
|
Use an ArrayList instead. It'll expand itself as needed when you .Add() elements to it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello
Use ArrayList instead.
Regards
|
|
|
|
|
Use a collection (list/stack/vector/etc) instead. Your scenario looks like a perfect case for dynamic memory allocation.
Best,
Jun
|
|
|
|
|
Hi,
I am writing an application that uses an extended listview. The extended listview is modified to reduce the flickering when being populated by only invalidating the single item being added. However, If another window is dragged to overlap my application while the listview is being populated, the listview does not redraw when the overlapping window is moved out of the way.
Therefore, I think I need to capture the event when the window overlaps my control. How can I do this? I believe there is an win api that can flag this, but I am not sure which one. Anyone know or anyone have a better approach?
Thanks in advance
Peter
|
|
|
|
|
You almost never have to detect overlappings. Windows handles the window stack and z-order automatically. When part of a window is covered, the covered portion won't be updated in the dark. If you force a update, the chances are you also bring that portion to the front at the same time.
Note that this does not stop you from updating the data at any time you want. Windows only controls the rendering on the screen.
Best,
Jun
|
|
|
|
|
What I have done is set a flag while adding a new item. I have also overridden the WndProc to stop it erasing the background and invalidates the new items rectangle. When the flag is set, only the new items rectangle is repainted and not the whole control
However, the effect when a window overlaps my control while this flag is set is that the background is not repainted as my WndProc prevents this. Therefore, I need to somehow detect when a window overlaps my control so that I can tell WndProc to allow the background to be repainted.
I hope this explains my problem. Please feel free to make suggestions on how to do this or a better approach
Thanks again
Peter
|
|
|
|
|
You can optimize the loading of items by calling BeginUpdate() on the ListView, then using the AddRange method on the Items collection, then call EndUpdate(). The Begin/EndUpdate methods prevent the control from redrawing while the items are populated. The AddRange ensures that the control suspends frivilous calculations when adding many items.
|
|
|
|
|
Hi,
Thanks for the reply.
I've already tried BeginUpdate/EndUpdate and AddRange. However, each of these still repaint the whole control causing a flicker.
The setup I have is quite unusual. On a normal winform application both these approaches are successful. However, I have an activeX user control written in C# containing the listview and have exposed methods and events through COM. The activeX control is displayed on a web page using the <object> tags. This has been successful using the BeginUpdate/EndUpdate approach and .NET 1.1 where only a slight flicker was visible. However, now we are updating our desktops to include .NET 2.0 and .NET 1.1. This seems to exagerate the flickering hence why I have take my approach to reduce the flickering.
Thanks again
Peter
|
|
|
|
|
Hi,
Iam using C# Express Edition.I want to create a windows service ,But there is no template for windows service in express Edition.Where can i download the Windows service template.
Thanks in advance.
|
|
|
|
|
|
I pasted up a tweaked version of the service template that I use for my own use. It's hooked up for running it debug (which VS won't let you do with services), just use the NO_SERVICE compile flag. This is similar to something someone posted in an article recently. Anyway, enjoy.
Windows service template (8k)
|
|
|
|
|
Hi all,
I would like to know which one of the above is a preferred tool for c# managed class library's documentation.Please comment on the following criteria.
1. Stability
2. performance(speed,error free document creation etc)
3. Ease of Installation and use(user friedly)
We are using Microsoft .Net SDK V2.0 , without Visual Studio. I would also like to know if it is necessary to have visual studio to use these tools and if not what are the installation procedures. Any comments on this regards would be very helpful.
|
|
|
|
|
sharath nelaturu wrote: We are using Microsoft .Net SDK V2.0 , without Visual Studio. I would also like to know if it is necessary to have visual studio to use these tools and if not what are the installation procedures
How you thought of asking the people who wrote those applications?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi Dave,
I am sorry, I meant no offence to anybody. I am new to this, I have just started using .NET so i dont know much abt it. I was just trying to get some information thats all. I just wanted to know which one of these tools s preferable for documentation. I am sorry if I didnt phrase the question properly.
Thanks,
Sharath
|
|
|
|