|
ArrayList al = new ArrayList();
Label mylabel =new Label();
al.Add(mylabel);
al.Add(mylabel);
// now I have two objects in the array...
((Label)al[0]).Location = new Point(100,100);
((Label)al[1]).Location = new Point(100,200);
// that's it
when the program run i see only one label.
why?
|
|
|
|
|
Hi,
The problem is that you're are adding two times the same isntance of label...
Try to create a new label when you're adding it to the arraylist. Try this:
ArrayList al = new ArrayList();<br />
for( int i = 0; i< 10; i++)<br />
al.Add(new Label());<br />
((Label)al[0]).Location = new Point(100,100);<br />
((Label)al[1]).Location = new Point(100,200);<br />
...<br />
((Label)al[9]).Location = new Point(100,200);
Too, You can create an array of labels instead of an arraylist...
|
|
|
|
|
did that
still
i don't see my labels on the form
maybe I need to use:
controls.add ?
|
|
|
|
|
Yes. You're right. The code is the following above:
ArrayList al = new ArrayList();<br />
for( int i = 0; i< 10; i++)<br />
{<br />
Label oLabel = new Label();<br />
al.Add(new Label());<br />
this.Controls.Add(oLabel);<br />
}<br />
((Label)al[0]).Location = new Point(100,100);<br />
((Label)al[1]).Location = new Point(100,200);<br />
...<br />
((Label)al[9]).Location = new Point(100,200);
|
|
|
|
|
From PC1 I am trying to connect to a webservice on my machine.
This path works fine on my machine.
http://gbws-00201234/codeservice/inger.asmx
It lets me see all the functions.
But when browsing from any other machine on the network, it gives an error:
The page can not be displayed. page is unavailable...
On my machine I have got firewall turned off.
Other pcs can ping my machine and vice versa.
Any ideas please?
Thanks
|
|
|
|
|
Sir/Madam
I am Final Year Engineering student. I want to get information about connection of computers at different cites.
Actually if I want to computerize a department of any company which have its offices at several cities then what steps I should follow.
Means how I can connect that no of computers in appropriate manner to get desired output.
I want to make it just like railway reservation system through in which if I enter data at same time then database must be able to prioritize data in sequence to enter in database.
Which database & platform or language I should use to code this kind of project.
Thank You
Ashish Porwal
|
|
|
|
|
I to all,
is it possible to create a c# applicatiom and put it in a browser like an activeX to install??
any examples or resource?
thanks a lot
Teo
|
|
|
|
|
Hi,
Developing Env: .NET Studio in C#, windows XP
target: a COM object used for excel user (RTD)
I have no problem to compile and run the project in my
machine. The excel is working great with RTD calls.
However, I got issues when I try to deploy it to another machine.
I use
regasm my.dll /tlb (or) regasm /codebase my.dll
gacutil -if my.dll or gacutil /i my.dll
The excel is not working with RTD calls.It's not invoking my dll (I had log file in my dll ).
I am not sure why it's not working in other machine by registering the above method.
Is there any way to register .NET dll and I can
can deploy it in other machine and let Excel users call it
directly (by RTD)?
Thanks,
Gnanaprakash
|
|
|
|
|
I wrote a new service "myservice" that starts automatically depending on
another service. When "myservice" is started I need that no registration
is made in the event viewer of Windows.
Is this possible, if yes is there a simple example of this?
Thank you in advance
rodrigo
rodrigo
|
|
|
|
|
ServiceBase.AutoLog = false;
Jon Humphreys
ActivePlanet Software
|
|
|
|
|
How do I make my newly completed software a trial version based on number of loading period?
How do I make my newly completed software a trial version based on number of Days?
|
|
|
|
|
|
Am having problem creating a parameter oriented report using crystal report based on SQL Server 2000 and (C#.Net 2005). Such problems includes:
How do I prepare a report to print an employee's record based on the Employee Number?
How do I prepare a report to print employees records whose appointment date falls within a specific date range?
I shall appreciate your quick rsponse.
Thanks
Banjo
|
|
|
|
|
|
How can I insert and select an image from a sql database in my app.
Dad
|
|
|
|
|
simply take a column with type of varbinary or Image (i tried varbinary) and select and insert like other things
Select Image from Customer where Id = @Id<br />
Insert Into Customer (Image) values(@Image)<br />
Update Customer set Image = @image where Id = @Id
...
in ur application create an array of bytes and a memory stream
for displaying image select image and assign it to byte array
and write byte array to stream
MemoryStream m = new MemoryStream;<br />
m.Write(imageBytes);<br />
Image.FromStream(m);<br />
....
and for inserting just read image with binary reader into the array of bytes and insert into Db
may there was some type error sorry i don't write it in visual studio
I Wish the Life Had CTRL-Z
|
|
|
|
|
Hi Friends
Can u tell me how to download file(like txt,doc). In my project i am uploading and downloading Files. I completed uploading but i dont how to download. If i click download button in my form it has to open 'Save As' dialog box and then user have to give filename to save then it has to store.
How to do this one. Pls send me answer.
Thanks in Advance
Prabhakaran
|
|
|
|
|
Hi,
Here you have sample code to open a file using OpenFileDialog:
private System.Windows.Forms.OpenFileDialog openFileDialog;<br />
string sPath = "";<br />
DialogResult dr = openFileDialog.ShowDialog(this);<br />
<br />
if (dr == DialogResult.OK)<br />
{<br />
sPath = openFileDialog.FileName;<br />
}
|
|
|
|
|
When you say download are you saying you want to pull a file from a remote web server (http)? Or from a remote network share? Cause each one uses a different method to retrive the file. Or is the file local on the users system?
|
|
|
|
|
There are several articles here that provide a file downloader control.
Search[^]
Each one is a little bit different and provide for different features, but they all boil down to the same concept. Of course, I'm being a bit biased and will tell you to look at the article I wrote on it first.
An easy to use URL file downloader class for .NET[^]
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
I want to make a chat program that works over a lan but I don't know from where I can start.
Dad
|
|
|
|
|
|
I have created my own custom progressbar controls and i wish to assign them an icon for the toolbox.
I have read everything i found on the net including the super http://www.bobpowell.net/toolboxbitmap.htm[^]
The orginal idea was to assign as an icon the icon of System.Windows.Forms.ProgressBar but i have tried everything and I couldn't do it.
So i decided to add a new icon. That also didn't work. Finally i decided to use the ToolBoxBitmap("FILEONDISK") constructor but that didn't work also.
So two things are happening.
1)It doesn't work which is not probable
2)Something in testing is wrong.
My test procedure has been. Cleaning the project, building in debug and then in a designer of a form looking the toolbox.
Please if i'm doing something wrong tell me.
Also If someone has the solution to pute the .net controls icon in mine please also tell me.
Because it matters here are some details for the project
Default namespace: MyComponents.Windows
Assembly Name: MyComponents.Windows
The control is located in Controls\ProgressBar.cs in the project dir MyComponents\Windows.
Here is the class declaration
{<br />
[ToolboxBitmap(typeof(ResourceFinder), "System.Windows.Forms.ProgressBar.bmp")]<br />
public class ProgressBar:System.Windows.Forms.Control
ResourceFinder is an internal class outside Namespace declaration. As i have understood this should be sufficcient.
|
|
|
|
|
You need also the [ToolboxItem(true)] attribute.
In my tests for this I went crazy because it **seems** to work only if you reference the compiled dll and not with a reference to the project and this is not documented at all.
|
|
|
|
|
This is what I'm using and still it doesn't work.
<br />
internal class ResourceFinder<br />
{<br />
<br />
}<br />
namespace MyComponents.Windows.Controls<br />
{<br />
[ToolboxItem(true), ToolboxBitmap(typeof(ResourceFinder), "System.Windows.Forms.ProgressBar.bmp")]<br />
public class ProgressBar:System.Windows.Forms.Control<br />
In the same solution there is the GUI in another project. O compile the control and VS2005 populates automatically the Toolbar. But the icon is wrong.
|
|
|
|