Click here to Skip to main content
15,914,444 members
Home / Discussions / C#
   

C#

 
GeneralHelp capturing and showing video! Pin
Anonymous29-Nov-04 16:13
Anonymous29-Nov-04 16:13 
GeneralRe: Help capturing and showing video! Pin
Hugo Migneron30-Nov-04 10:33
Hugo Migneron30-Nov-04 10:33 
Generaluser controls and collections Pin
Anonymous29-Nov-04 15:38
Anonymous29-Nov-04 15:38 
QuestionHow to get LAN computer time programmly Pin
Mark_xiaodong29-Nov-04 13:57
Mark_xiaodong29-Nov-04 13:57 
AnswerRe: How to get LAN computer time programmly Pin
tom_dx29-Nov-04 14:45
tom_dx29-Nov-04 14:45 
AnswerRe: How to get LAN computer time programmly Pin
Robin Panther29-Nov-04 15:04
Robin Panther29-Nov-04 15:04 
Questionis there an event?? Pin
tom_dx29-Nov-04 12:55
tom_dx29-Nov-04 12:55 
GeneralVB Client hosting a Windows Forms control Pin
snene29-Nov-04 12:53
snene29-Nov-04 12:53 
Hello:

Here are two programs

1) MyDotNetControl - A windows form control displaying some UI
2) MyVBClient - A VB COM client app hosting the above control.

You'll need to build the control first and register is using regasm for Interop. Then run the VB program from the same location as the component. The VB program describes and shows the errant behavior. This was complied using VS2003.

Different behavior is seen when build using VS2003 and VS2005

1) VS2003 - When the user control loses focus, the text box and button disappear (the label does not). On double clicking they reappear but not on repaint.

2) VS2005 - When the user control loses focus, the text box disappears (the label and buttons do not). On double clicking they reappear but not on repaint.

Has anyone seen such problem? If so, how did you work around it?

Since there was no way to attach files, I had to include the source code here. I have a ZIP file containing the source code. If you can send me your email I can sent it to you. This should save you time.

Thanks a lot!
Sameer Nene

--------------------- Control in C#/.NET---------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace MyDotNetControl
{
///
/// Summary description for UserControl1.
///

public class UserControl1 : System.Windows.Forms.UserControl
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Panel panel1;
///
/// Required designer variable.
///

private System.ComponentModel.Container components = null;

public UserControl1()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();

// TODO: Add any initialization after the InitComponent call

}

///
/// Clean up any resources being used.
///

protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}

#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
components = new System.ComponentModel.Container();
panel1 = new System.Windows.Forms.Panel();

this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
panel1.Controls.Add(this.label1);
panel1.Controls.Add(this.button1);
panel1.Controls.Add(this.button2);
panel1.Controls.Add(this.textBox1);
this.SuspendLayout();
//
// label1
//
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label1.Location = new System.Drawing.Point(104, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(152, 23);
this.label1.TabIndex = 0;
this.label1.Text = "My UserControl";
//
// button1
//
this.button1.BackColor = System.Drawing.Color.Cornsilk;
this.button1.Location = new System.Drawing.Point(48, 120);
this.button1.Name = "button1";
this.button1.TabIndex = 2;
this.button1.Text = "button1";
//
// button2
//
this.button2.BackColor = System.Drawing.Color.Cornsilk;
this.button2.Location = new System.Drawing.Point(200, 120);
this.button2.Name = "button2";
this.button2.TabIndex = 3;
this.button2.Text = "button2";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(120, 72);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 1;
this.textBox1.Text = "textBox1";
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// UserControl1
//
this.BackColor = System.Drawing.Color.CornflowerBlue;
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Name = "UserControl1";
this.Size = new System.Drawing.Size(352, 200);
this.Load += new System.EventHandler(this.UserControl1_Load);
this.ResumeLayout(false);

}
#endregion

}
}
-----------------------------------------------------------------------------------

VB Client

Option Explicit
Dim myCtl As Control


Private Sub Form_Load()

Set myCtl = Controls.Add("MyDotNetControl.UserControl1", "MyApp", Form1)
myCtl.Visible = True

myCtl.Width = 4500
myCtl.Height = 3500
Label1.Caption = "When tabbed out of the user control (blue color), the control disappears. " & vbCrLf & vbCrLf & "On double clicking in the user control, it reappears." & vbCrLf & vbCrLf & "Forcing a paint by bringing another control on top doesn't work either." & vbCrLf & vbCrLf & "This problem is seen with MFC client applications as well." & vbCrLf & vbCrLf & "The interesting thing to note, however, is that the Label control shows up always."
End Sub
GeneralFileSystemWatcher process name Pin
DotNetDude29-Nov-04 10:36
DotNetDude29-Nov-04 10:36 
GeneralRe: FileSystemWatcher process name Pin
Dave Kreskowiak30-Nov-04 3:43
mveDave Kreskowiak30-Nov-04 3:43 
GeneralXML Deserialization from a Stream Pin
tkmcclean29-Nov-04 9:45
susstkmcclean29-Nov-04 9:45 
Generalreg value retrieval Pin
Pyro Joe29-Nov-04 9:25
Pyro Joe29-Nov-04 9:25 
GeneralDisplaying an Array in a Property Grid Pin
JaydeepM29-Nov-04 8:09
JaydeepM29-Nov-04 8:09 
GeneralRe: Displaying an Array in a Property Grid Pin
Nick Parker29-Nov-04 10:01
protectorNick Parker29-Nov-04 10:01 
Generalreading from file Pin
eemo_mb29-Nov-04 8:04
eemo_mb29-Nov-04 8:04 
Generalwebservice file transfer Pin
fmarcos29-Nov-04 7:50
fmarcos29-Nov-04 7:50 
GeneralBinding 2 EXE into my aplication Pin
Ngh5529-Nov-04 6:44
Ngh5529-Nov-04 6:44 
GeneralRe: Binding 2 EXE into my aplication Pin
tom_dx29-Nov-04 12:57
tom_dx29-Nov-04 12:57 
GeneralRe: Binding 2 EXE into my aplication Pin
Dave Kreskowiak30-Nov-04 3:29
mveDave Kreskowiak30-Nov-04 3:29 
Generalfinding the contents of a cell in a datagrid Pin
steve_rm29-Nov-04 4:48
steve_rm29-Nov-04 4:48 
GeneralRe: finding the contents of a cell in a datagrid Pin
Colin Mc29-Nov-04 5:34
Colin Mc29-Nov-04 5:34 
GeneralRe: finding the contents of a cell in a datagrid Pin
DougW4829-Nov-04 13:27
DougW4829-Nov-04 13:27 
GeneralWeb Service Responce size Pin
Colin Mc29-Nov-04 4:30
Colin Mc29-Nov-04 4:30 
GeneralUsing different ActiveX control versions Pin
mav.northwind29-Nov-04 4:12
mav.northwind29-Nov-04 4:12 
GeneralDllImport, EntryPoint Problem Pin
Gywox29-Nov-04 3:55
Gywox29-Nov-04 3:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.