|
Hi.
I put some Label controls on a form and then put Text into them. I also wanted to put a random number into some labels on the same form. So I do this:
Random r = new Random();
label6.Text = r.Next(88).ToString();
label6.Location = new Point(90,60);
this.Controls.Add(label6);
This is what I did to the other Labels that I want on my form except I did not put a random number into them. The problem is that the label (label6) doesn´t show up on the form. Why is that? What am I missing? What do I need to do so that the label shows up on the form containing a random number?
Thanks,
FJ
|
|
|
|
|
You don't need to do anything different, so that is not where the problem is. Can you set the location before adding it to the form ? I'd have done those two in the other order.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Is there a way to speed up starting of an c# application?
i'm using microsoft internet control and it takes a few seconds to load, can I precache or something?
Thanx in advance.
Lju2
|
|
|
|
|
Hello All,
I made a Com+ component connect over network to insert , update and delete from the Sql serve in the same network. but i got error means that no connectivity between the server and client.
I need to know what is the default ports and portocols that the Com+ user it over the network?
Thanks
Hay
|
|
|
|
|
A search in the Microsoft Knowledge Base for COM+ ports to open for firewalls[^] yields what you want. The first result - How to configure RTP dynamic port allocation to work with firewalls[^] is probably what you want. The linked article How to configure a firewall for domains and trusts[^] might also be helpful to solve potential authentication issues.
You could also define either a specific unused port for the COM+ component or a static range for all components and open those on the firewall, but the former would be more secure. Don't forget to open ports on the client
Also keep in mind authentication. Once you've solves connection problems make sure that you've set up the appropriate authentication and authorization for your component using the Component Services MMC snap-in. Much of that can be configured using the appropriate attributes on your COM+ service, too.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
|
|
I am using a TreeView Control to view the complete set of folders in Outlook and now I have the complete set I want to prune the ones that don't have the capability of storing mail messages.
What I want to to do is only add those folders to the Treeviw that are of the correct type which means I need to query the type.
I expected to be able to do something like:-
if (currentFolder.GetTypeOfFolder = olMailFolder) {
AddChild(...)
}
but I can't find any reference to a folder type that I might be able to use in this way. Anyone with any bright ideas?
Cheers,
Goose
|
|
|
|
|
Hold that thought, just answered it myself!
For those interested, the answer is:-
if (mF.DefaultItemType == Outlook.OlItemType.olMailItem) {
AddChild(...)
}
|
|
|
|
|
How do you paint a user control with transparent background?
I have set this line in the constructor: this.SetStyle( ControlStyles.SupportsTransparentBackColor , true ); , but now my control has a black background.
Regards,
Johnny
|
|
|
|
|
Do you also have these two lines?
this.SetStyle(ControlStyles.UserPaint, true);
this.BackColor = System.Drawing.Color.FromArgb(0, 0, 0, 0);
|
|
|
|
|
Yeah, I was deriving from CheckBox and i think that was the problem. Now I'm deriving from usercontrol and it works like it supposed to.
Thanks anyways
|
|
|
|
|
I'm trying to write a sliding panel custom control. As regards the component sliding etc it is all ok. However, during design mode the V.S. doesn't let me place controls inside the panel. It places them on top of the panel, not into it. Can any one help out on this.
Best Regards
|
|
|
|
|
Try deriving your custom control class from System.Windows.Forms.Panel instead of System.Windows.Forms.UserControl
Hope this is what you are looking for...
Greatings,
Johnny
|
|
|
|
|
Did you set ControlStyles.ContainerControl style on your control?
(using Control.SetStyle() )
Regards,
mav
|
|
|
|
|
Hi,
I'm building a small application where I like to capure a part of the application screen and save it as a image.
Does anyone know of any tutorials o similiar about this??
The part I like capture is filled with a flash application if that will make it any difference.
Best regards
Magnus
|
|
|
|
|
If you search for screen capture[^] in the article search box at the top of every page right under the Code Project logo you can find many helpful articles and sample code.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Question please
I'd like to access data from database using dataset dependent on the
selectedValue in combobox.
My combobox's displays displayMember FieldName,
based on its valueMember fieldId,
i'd like be able to access the FieldAddress
which are all in Fields Table.
thank you!
I wanna have something like this, except it doesn't return the whole row but just the Address:
<br />
DataRow drSelectedCustomer;<br />
drSelectedCustomer = <br />
dsNorthwind1.Customers.FindByCustomerID(SelectedCustomerID);
thank you again
Gerri
|
|
|
|
|
I'm really struggling trying to bind a Datagrid to a collection of objects. I understand that for each public property of the objects in the collection, a column will be displayed. But I don't want to display a column for all of the public properties, just some of them. And I also want to add columns to the datagrid for things like an image that is associated with one of the properties.
How do you hide columns when binding to objects?
How do you add columns to a datagrid when it is bound to a collection of objects?
Any help would be greatly appreciated!
Thanks
Warwick
"I hear they've even got the internet on Computers now." - Homer Simpson
|
|
|
|
|
If you databind a datagrid to a list of objects, it will create a column for each property as you said.
However, if you first create a DataGridTableStyle and add to it the DataGridColumnStyle objects that you want then only those columns will be shown.
This can be done directly in the designer.
|
|
|
|
|
Thanks! I've just had a look at TableStyles/ColumnStyles and will try it today.
Cheers
Warwick
"I hear they've even got the internet on Computers now." - Homer Simpson
|
|
|
|
|
Take a look at ITypedList. Adding it to your collection allows you to create property descriptors. The Datagrid will respect this list. This is more "class friendly" to implementers and they won't have to use table styles to get rid of the unfriendly stuff.
|
|
|
|
|
Hi,
Can someone please tell me how can I zoom in and out of an image that is displayed in a picture box control???
Please Help...
Thanks,
E.A.
|
|
|
|
|
As far as I know, the picturebox does not directly support such a thing. You would have to write custom code to scale the image from an offscreen source image, then reset the picture box .Image property. You could also write your own simple custom control that intrinsically supports image scaling, which would be more elegant and probably smoother.
|
|
|
|
|
Here's an example of what I'm dealing with:
int[] myints = new int { 1, 2, 3 };
foreach(int i in myints)
{
Console.Write(i.ToString()); // WORKS PERFECT.
}
Console.Write(myints.Length); // Displays 3.
int[] newints = new int { 1, 2, 3, 4 };
myints = newints;
foreach(int i in myints)
{
Console.Write(i.ToString()); // WORKS PERFECT.
}
Console.Write(myints.Length); // Displays 4
int[] reallynewints = new int { 1, 2 };
myints = reallynewints;
foreach(int i in myints)
{
Console.Write(i.ToString()); // THROWS NULLEXCEPTIONERROR
}
Console.Write(myints.Length); // Displays 2
So, here's the problem I'm having. When you set an array equal to an array with less elements, the Length property is updated, but there is still a null reference inside the array to an unused array element. You can fix the problem by overloading the Int.ToString() method with a try-catch block to avoid the error, but that's just a patch. How can I reset the array completely, so there is not a null reference to unused elements?
|
|
|
|