473,856 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A IP Control

I was goofing around tonight and decided to write a little IP address
control. I had written a simple one a long time ago, but I decided I
should try to write one that was half way correct :) Anyway, here is the
result of about an hour and half of work...

// IPControl.cs
using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Drawing;
using System.Data;
using System.Windows. Forms;
using System.Net;
using System.Runtime. InteropServices ;

namespace FireAnt.Control s
{

/// <summary>
/// Simple API Based IP Control
/// </summary>
public class IPControl : System.Windows. Forms.UserContr ol
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.Componen tModel.Containe r components = null;
private NativeIPControl ipControl;

public event FieldChangedDel egate FieldChanged;

public IPControl()
{
// This call is required by the Windows.Forms Form Designer.
InitializeCompo nent();

// create the native ip control
this.ipControl =
new NativeIPControl (this.Handle, this.Height, this.Width);
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}

/// <summary>
/// Overridden window procedure
/// </summary>
/// <param name="m">Window message to process</param>
protected override void WndProc(ref Message m)
{
// we need to over ride this so that we
// can receive notification messages from the
// native ip control window...
switch (m.Msg)
{
case Win32Interop.WM _NOTIFY:
unsafe
{
Win32Interop.NM HDR* nmhdr = (Win32Interop.N MHDR*) m.LParam;
if (nmhdr->code == Win32Interop.IP N_FIELDCHANGED)
{
Win32Interop.NM IPADDRESS* nmaddr
= (Win32Interop.N MIPADDRESS*) m.LParam;

// fire a field changed event...
FieldChangedEve ntArgs e
= new FieldChangedEve ntArgs(nmaddr->iField, nmaddr->iValue);
if (this.FieldChan ged != null)
{
this.FieldChang ed (this, e);
}

// change the feild value...
nmaddr->iValue = e.Value;
}
else
{
base.WndProc(re f m);
}
}
break;
default:
base.WndProc (ref m);
break;
}
}

#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
//
// FAIPControl
//
this.Name = "IPControl" ;
this.Size = new System.Drawing. Size(132, 20);
this.Enter += new System.EventHan dler(this.IPCon trol_Enter);

}
#endregion

/// <summary>
/// Get/Set the IP address for the control
/// </summary>
[Browsable(false ),
ReadOnly(true)]
public IPAddress Address
{
get
{
uint address = 0;

if (Win32Interop.S endMessage (
this.ipControl. Handle,
Win32Interop.IP M_ISBLANK,
0,
0) == 0)
{
// get the address
Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_GETADDRESS,
0,
out address
);

// we need to reverse the order...
byte[] buffer = BitConverter.Ge tBytes(address) ;
System.Array.Re verse(buffer, 0, buffer.Length);
address = BitConverter.To UInt32(buffer, 0);
}

return new IPAddress(addre ss);
}
set
{
// we need to get the bytes, and reverse the order
byte[] buffer = value.GetAddres sBytes();
System.Array.Re verse(buffer, 0, buffer.Length);
uint address = BitConverter.To UInt32(buffer, 0);

// now set the value
Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_SETADDRESS,
0,
address
);
}
}

/// <summary>
/// Clear the control
/// </summary>
public void Clear()
{
// clear the ip values...
Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_CLEARADDRESS,
0,
0
);
}

/// <summary>
/// Set focus to a particular field in the control
/// </summary>
/// <param name="field">Th e zero based field index to set focus
to</param>
public void Focus(int field)
{
if (field < 0 || field > 3)
{
throw new ArgumentOutOfRa ngeException (
"field",
field,
"Field must be between 0 and 3");
}

Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_SETFOCUS,
(uint) field, 0
);
}

private void IPControl_Enter (object sender, System.EventArg s e)
{
// set the focus to our ip control...
Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_SETFOCUS,
0,
0
);
}
/// <summary>
/// Native Windows IP Control Class
/// </summary>
private class NativeIPControl : System.Windows. Forms.NativeWin dow
{
public NativeIPControl (IntPtr parent, int height, int width)
{
// create the create params structure
CreateParams cp = new CreateParams();

// fill it in...
cp.ClassName = Win32Interop.WC _IPADDRESS;
cp.Style = Win32Interop.WS _CHILD | Win32Interop.WS _VISIBLE;
cp.X = 0;
cp.Y = 0;
cp.Height = height;
cp.Width = width;
cp.Parent = parent;

// create the window
this.CreateHand le(cp);
}

// we'll probably need this latter...
protected override void WndProc(ref Message m)
{
// for now just call the default procedure
base.DefWndProc (ref m);
}
}

}

public class FieldChangedEve ntArgs : System.EventArg s
{
private int field;
private int newValue;

internal FieldChangedEve ntArgs(int field, int newValue)
{
this.field = field;
this.newValue = newValue;
}

public int Field
{
get
{
return this.field;
}
}

public int Value
{
get
{
return this.newValue;
}
set
{
if (value >= 0 && value <= 255)
{
this.newValue = value;
}
}
}
}

public delegate void FieldChangedDel egate (
object sender, FieldChangedEve ntArgs e);

}

// Win32Interop.cs
using System;
using System.Runtime. InteropServices ;

namespace FireAnt.Control s
{
/// <summary>
/// Win32 Interop Definitions
/// </summary>
internal sealed class Win32Interop
{
// Window Style Constants
public const int WS_CHILD = 0x40000000;
public const int WS_VISIBLE = 0x10000000;

// Window Class Names
public const string WC_IPADDRESS = "SysIPAddress32 ";

// IP Control Window Messages
public const uint IPM_CLEARADDRES S = (WM_USER+100); // no parameters
public const uint IPM_SETADDRESS = (WM_USER+101); // lparam = TCP/IP
address
public const uint IPM_GETADDRESS = (WM_USER+102); // lresult = # of non
black fields. lparam = LPDWORD for TCP/IP address
public const uint IPM_SETRANGE = (WM_USER+103); // wparam = field,
lparam = range
public const uint IPM_SETFOCUS = (WM_USER+104); // wparam = field
public const uint IPM_ISBLANK = (WM_USER+105); // no parameters

// IP Control Notification Messages
public const int WM_NOTIFY = 0x004E;
public const uint IPN_FIELDCHANGE D = (IPN_FIRST - 0);

// IP Control Structures
[StructLayout(La youtKind.Sequen tial)]
public struct NMHDR
{
public IntPtr hwndFrom;
public uint idFrom;
public uint code;
}

[StructLayout(La youtKind.Sequen tial)]
public struct NMIPADDRESS
{
public NMHDR hdr;
public int iField;
public int iValue;
}

#region API Function Calls
[DllImport("user 32", CharSet=CharSet .Auto, SetLastError=tr ue)]
public static extern uint SendMessage (
IntPtr hWnd,
uint Msg,
uint wParam,
uint lParam
);

[DllImport("user 32", CharSet=CharSet .Auto, SetLastError=tr ue)]
public static extern uint SendMessage (
IntPtr hWnd,
uint Msg,
uint wParam,
out uint lParam
);
#endregion

#region Private Data
// private window message constants
private const uint WM_USER = 0x0400;
private const uint IPN_FIRST = unchecked(0U-860U); // internet address
private const uint IPN_LAST = unchecked(0U-879U); // internet address
private Win32Interop() {}
#endregion

}
}

Sorry, the code is in C# - but I thought I'd share it with you guys anyway.

HTH
--
Tom Shelton [MVP]
Nov 20 '05 #1
2 4387
Hi Tom,

Thanks for sending this, however when I would do it this way I had the
change to be flamed by Herfried.

:-)

And than I would laugh.

Cor
I was goofing around tonight and decided to write a little IP address
control. I had written a simple one a long time ago, but I decided I
should try to write one that was half way correct :) Anyway, here is the
result of about an hour and half of work...

// IPControl.cs
using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Drawing;
using System.Data;
using System.Windows. Forms;
using System.Net;
using System.Runtime. InteropServices ;

namespace FireAnt.Control s
{

/// <summary>
/// Simple API Based IP Control
/// </summary>
public class IPControl : System.Windows. Forms.UserContr ol
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.Componen tModel.Containe r components = null;
private NativeIPControl ipControl;

public event FieldChangedDel egate FieldChanged;

public IPControl()
{
// This call is required by the Windows.Forms Form Designer.
InitializeCompo nent();

// create the native ip control
this.ipControl =
new NativeIPControl (this.Handle, this.Height, this.Width);
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}

/// <summary>
/// Overridden window procedure
/// </summary>
/// <param name="m">Window message to process</param>
protected override void WndProc(ref Message m)
{
// we need to over ride this so that we
// can receive notification messages from the
// native ip control window...
switch (m.Msg)
{
case Win32Interop.WM _NOTIFY:
unsafe
{
Win32Interop.NM HDR* nmhdr = (Win32Interop.N MHDR*) m.LParam;
if (nmhdr->code == Win32Interop.IP N_FIELDCHANGED)
{
Win32Interop.NM IPADDRESS* nmaddr
= (Win32Interop.N MIPADDRESS*) m.LParam;

// fire a field changed event...
FieldChangedEve ntArgs e
= new FieldChangedEve ntArgs(nmaddr->iField, nmaddr->iValue);
if (this.FieldChan ged != null)
{
this.FieldChang ed (this, e);
}

// change the feild value...
nmaddr->iValue = e.Value;
}
else
{
base.WndProc(re f m);
}
}
break;
default:
base.WndProc (ref m);
break;
}
}

#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
//
// FAIPControl
//
this.Name = "IPControl" ;
this.Size = new System.Drawing. Size(132, 20);
this.Enter += new System.EventHan dler(this.IPCon trol_Enter);

}
#endregion

/// <summary>
/// Get/Set the IP address for the control
/// </summary>
[Browsable(false ),
ReadOnly(true)]
public IPAddress Address
{
get
{
uint address = 0;

if (Win32Interop.S endMessage (
this.ipControl. Handle,
Win32Interop.IP M_ISBLANK,
0,
0) == 0)
{
// get the address
Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_GETADDRESS,
0,
out address
);

// we need to reverse the order...
byte[] buffer = BitConverter.Ge tBytes(address) ;
System.Array.Re verse(buffer, 0, buffer.Length);
address = BitConverter.To UInt32(buffer, 0);
}

return new IPAddress(addre ss);
}
set
{
// we need to get the bytes, and reverse the order
byte[] buffer = value.GetAddres sBytes();
System.Array.Re verse(buffer, 0, buffer.Length);
uint address = BitConverter.To UInt32(buffer, 0);

// now set the value
Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_SETADDRESS,
0,
address
);
}
}

/// <summary>
/// Clear the control
/// </summary>
public void Clear()
{
// clear the ip values...
Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_CLEARADDRESS,
0,
0
);
}

/// <summary>
/// Set focus to a particular field in the control
/// </summary>
/// <param name="field">Th e zero based field index to set focus
to</param>
public void Focus(int field)
{
if (field < 0 || field > 3)
{
throw new ArgumentOutOfRa ngeException (
"field",
field,
"Field must be between 0 and 3");
}

Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_SETFOCUS,
(uint) field, 0
);
}

private void IPControl_Enter (object sender, System.EventArg s e)
{
// set the focus to our ip control...
Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_SETFOCUS,
0,
0
);
}
/// <summary>
/// Native Windows IP Control Class
/// </summary>
private class NativeIPControl : System.Windows. Forms.NativeWin dow
{
public NativeIPControl (IntPtr parent, int height, int width)
{
// create the create params structure
CreateParams cp = new CreateParams();

// fill it in...
cp.ClassName = Win32Interop.WC _IPADDRESS;
cp.Style = Win32Interop.WS _CHILD | Win32Interop.WS _VISIBLE;
cp.X = 0;
cp.Y = 0;
cp.Height = height;
cp.Width = width;
cp.Parent = parent;

// create the window
this.CreateHand le(cp);
}

// we'll probably need this latter...
protected override void WndProc(ref Message m)
{
// for now just call the default procedure
base.DefWndProc (ref m);
}
}

}

public class FieldChangedEve ntArgs : System.EventArg s
{
private int field;
private int newValue;

internal FieldChangedEve ntArgs(int field, int newValue)
{
this.field = field;
this.newValue = newValue;
}

public int Field
{
get
{
return this.field;
}
}

public int Value
{
get
{
return this.newValue;
}
set
{
if (value >= 0 && value <= 255)
{
this.newValue = value;
}
}
}
}

public delegate void FieldChangedDel egate (
object sender, FieldChangedEve ntArgs e);

}

// Win32Interop.cs
using System;
using System.Runtime. InteropServices ;

namespace FireAnt.Control s
{
/// <summary>
/// Win32 Interop Definitions
/// </summary>
internal sealed class Win32Interop
{
// Window Style Constants
public const int WS_CHILD = 0x40000000;
public const int WS_VISIBLE = 0x10000000;

// Window Class Names
public const string WC_IPADDRESS = "SysIPAddress32 ";

// IP Control Window Messages
public const uint IPM_CLEARADDRES S = (WM_USER+100); // no parameters
public const uint IPM_SETADDRESS = (WM_USER+101); // lparam = TCP/IP
address
public const uint IPM_GETADDRESS = (WM_USER+102); // lresult = # of non
black fields. lparam = LPDWORD for TCP/IP address
public const uint IPM_SETRANGE = (WM_USER+103); // wparam = field,
lparam = range
public const uint IPM_SETFOCUS = (WM_USER+104); // wparam = field
public const uint IPM_ISBLANK = (WM_USER+105); // no parameters

// IP Control Notification Messages
public const int WM_NOTIFY = 0x004E;
public const uint IPN_FIELDCHANGE D = (IPN_FIRST - 0);

// IP Control Structures
[StructLayout(La youtKind.Sequen tial)]
public struct NMHDR
{
public IntPtr hwndFrom;
public uint idFrom;
public uint code;
}

[StructLayout(La youtKind.Sequen tial)]
public struct NMIPADDRESS
{
public NMHDR hdr;
public int iField;
public int iValue;
}

#region API Function Calls
[DllImport("user 32", CharSet=CharSet .Auto, SetLastError=tr ue)]
public static extern uint SendMessage (
IntPtr hWnd,
uint Msg,
uint wParam,
uint lParam
);

[DllImport("user 32", CharSet=CharSet .Auto, SetLastError=tr ue)]
public static extern uint SendMessage (
IntPtr hWnd,
uint Msg,
uint wParam,
out uint lParam
);
#endregion

#region Private Data
// private window message constants
private const uint WM_USER = 0x0400;
private const uint IPN_FIRST = unchecked(0U-860U); // internet address
private const uint IPN_LAST = unchecked(0U-879U); // internet address
private Win32Interop() {}
#endregion

}
}

Sorry, the code is in C# - but I thought I'd share it with you guys anyway.
HTH
--
Tom Shelton [MVP]

Nov 20 '05 #2
This is really cool.

"Tom Shelton" <to*@YOUKNOWTHE DRILLmtogden.co m> wrote in message
news:1r******** *************** ********@40tude .net:
I was goofing around tonight and decided to write a little IP address
control. I had written a simple one a long time ago, but I decided I
should try to write one that was half way correct :) Anyway, here is the

result of about an hour and half of work...

// IPControl.cs
using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Drawing;
using System.Data;
using System.Windows. Forms;
using System.Net;
using System.Runtime. InteropServices ;

namespace FireAnt.Control s
{

/// <summary>
/// Simple API Based IP Control
/// </summary>
public class IPControl : System.Windows. Forms.UserContr ol
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.Componen tModel.Containe r components = null;
private NativeIPControl ipControl;

public event FieldChangedDel egate FieldChanged;

public IPControl()
{
// This call is required by the Windows.Forms Form Designer.
InitializeCompo nent();

// create the native ip control
this.ipControl =
new NativeIPControl (this.Handle, this.Height, this.Width);
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}

/// <summary>
/// Overridden window procedure
/// </summary>
/// <param name="m">Window message to process</param>
protected override void WndProc(ref Message m)
{
// we need to over ride this so that we
// can receive notification messages from the
// native ip control window...
switch (m.Msg)
{
case Win32Interop.WM _NOTIFY:
unsafe
{
Win32Interop.NM HDR* nmhdr = (Win32Interop.N MHDR*) m.LParam;
if (nmhdr->code == Win32Interop.IP N_FIELDCHANGED)
{
Win32Interop.NM IPADDRESS* nmaddr
= (Win32Interop.N MIPADDRESS*) m.LParam;

// fire a field changed event...
FieldChangedEve ntArgs e
= new FieldChangedEve ntArgs(nmaddr->iField, nmaddr->iValue);
if (this.FieldChan ged != null)
{
this.FieldChang ed (this, e);
}

// change the feild value...
nmaddr->iValue = e.Value;
}
else
{
base.WndProc(re f m);
}
}
break;
default:
base.WndProc (ref m);
break;
}
}

#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
//
// FAIPControl
//
this.Name = "IPControl" ;
this.Size = new System.Drawing. Size(132, 20);
this.Enter += new System.EventHan dler(this.IPCon trol_Enter);

}
#endregion

/// <summary>
/// Get/Set the IP address for the control
/// </summary>
[Browsable(false ),
ReadOnly(true)]
public IPAddress Address
{
get
{
uint address = 0;

if (Win32Interop.S endMessage (
this.ipControl. Handle,
Win32Interop.IP M_ISBLANK,
0,
0) == 0)
{
// get the address
Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_GETADDRESS,
0,
out address
);

// we need to reverse the order...
byte[] buffer = BitConverter.Ge tBytes(address) ;
System.Array.Re verse(buffer, 0, buffer.Length);
address = BitConverter.To UInt32(buffer, 0);
}

return new IPAddress(addre ss);
}
set
{
// we need to get the bytes, and reverse the order
byte[] buffer = value.GetAddres sBytes();
System.Array.Re verse(buffer, 0, buffer.Length);
uint address = BitConverter.To UInt32(buffer, 0);

// now set the value
Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_SETADDRESS,
0,
address
);
}
}

/// <summary>
/// Clear the control
/// </summary>
public void Clear()
{
// clear the ip values...
Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_CLEARADDRESS,
0,
0
);
}

/// <summary>
/// Set focus to a particular field in the control
/// </summary>
/// <param name="field">Th e zero based field index to set focus
to</param>
public void Focus(int field)
{
if (field < 0 || field > 3)
{
throw new ArgumentOutOfRa ngeException (
"field",
field,
"Field must be between 0 and 3");
}

Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_SETFOCUS,
(uint) field, 0
);
}

private void IPControl_Enter (object sender, System.EventArg s e)
{
// set the focus to our ip control...
Win32Interop.Se ndMessage (
this.ipControl. Handle,
Win32Interop.IP M_SETFOCUS,
0,
0
);
}
/// <summary>
/// Native Windows IP Control Class
/// </summary>
private class NativeIPControl : System.Windows. Forms.NativeWin dow
{
public NativeIPControl (IntPtr parent, int height, int width)
{
// create the create params structure
CreateParams cp = new CreateParams();

// fill it in...
cp.ClassName = Win32Interop.WC _IPADDRESS;
cp.Style = Win32Interop.WS _CHILD | Win32Interop.WS _VISIBLE;
cp.X = 0;
cp.Y = 0;
cp.Height = height;
cp.Width = width;
cp.Parent = parent;

// create the window
this.CreateHand le(cp);
}

// we'll probably need this latter...
protected override void WndProc(ref Message m)
{
// for now just call the default procedure
base.DefWndProc (ref m);
}
}

}

public class FieldChangedEve ntArgs : System.EventArg s
{
private int field;
private int newValue;

internal FieldChangedEve ntArgs(int field, int newValue)
{
this.field = field;
this.newValue = newValue;
}

public int Field
{
get
{
return this.field;
}
}

public int Value
{
get
{
return this.newValue;
}
set
{
if (value >= 0 && value <= 255)
{
this.newValue = value;
}
}
}
}

public delegate void FieldChangedDel egate (
object sender, FieldChangedEve ntArgs e);

}

// Win32Interop.cs
using System;
using System.Runtime. InteropServices ;

namespace FireAnt.Control s
{
/// <summary>
/// Win32 Interop Definitions
/// </summary>
internal sealed class Win32Interop
{
// Window Style Constants
public const int WS_CHILD = 0x40000000;
public const int WS_VISIBLE = 0x10000000;

// Window Class Names
public const string WC_IPADDRESS = "SysIPAddress32 ";

// IP Control Window Messages
public const uint IPM_CLEARADDRES S = (WM_USER+100); // no parameters
public const uint IPM_SETADDRESS = (WM_USER+101); // lparam = TCP/IP
address
public const uint IPM_GETADDRESS = (WM_USER+102); // lresult = # of non

black fields. lparam = LPDWORD for TCP/IP address
public const uint IPM_SETRANGE = (WM_USER+103); // wparam = field,
lparam = range
public const uint IPM_SETFOCUS = (WM_USER+104); // wparam = field
public const uint IPM_ISBLANK = (WM_USER+105); // no parameters

// IP Control Notification Messages
public const int WM_NOTIFY = 0x004E;
public const uint IPN_FIELDCHANGE D = (IPN_FIRST - 0);

// IP Control Structures
[StructLayout(La youtKind.Sequen tial)]
public struct NMHDR
{
public IntPtr hwndFrom;
public uint idFrom;
public uint code;
}

[StructLayout(La youtKind.Sequen tial)]
public struct NMIPADDRESS
{
public NMHDR hdr;
public int iField;
public int iValue;
}

#region API Function Calls
[DllImport("user 32", CharSet=CharSet .Auto, SetLastError=tr ue)]
public static extern uint SendMessage (
IntPtr hWnd,
uint Msg,
uint wParam,
uint lParam
);

[DllImport("user 32", CharSet=CharSet .Auto, SetLastError=tr ue)]
public static extern uint SendMessage (
IntPtr hWnd,
uint Msg,
uint wParam,
out uint lParam
);
#endregion

#region Private Data
// private window message constants
private const uint WM_USER = 0x0400;
private const uint IPN_FIRST = unchecked(0U-860U); // internet address
private const uint IPN_LAST = unchecked(0U-879U); // internet address
private Win32Interop() {}
#endregion

}
}

Sorry, the code is in C# - but I thought I'd share it with you guys
anyway.

HTH


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3422
by: Bruce Rusk | last post by:
I'm using Stephen Lebans' RTF2 control in a report, and have discovered what may be a slight bug in it. I have a lot of non-Western language (Chinese) text in my RTF field, and such records get sized strangely using the .RTFHeight property of the control. Specifically, lines of text get cut off the bottom of the control when I use the code provided in the sample report on the lebans.com site. It seems that when there is Chinese text,...
6
11319
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header" Src="WebControls/Header.ascx" %> The web user control contains the following server controls
2
3636
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
20
5677
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just client-side HTML, CSS, etc. What I want to do is somehow insert a *server control* into the , then set the server control's properties at runtime.
5
3604
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact that for server control component , code is running on the server side. But if I take as example a Label. I place on a webform an HTM label control and a WebForm label control, I could see that properties are different for
2
4937
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is being updated by some other process through remoting. When the page loads, I init the tree, and in my browser I can see the initialized tree. The problem is that every time that I receive update to tree from the remote process,
4
3350
by: gsb58 | last post by:
Hi! On a form I have a calendar. The form is rezised to 1024x768 (Don't worry - this is a training case) when loaded. Now I want to center the calendar on the form so that its edges are equally far from the upper, right, left and bottom borders of the form. I understand I must use the location property, am I right?
5
2347
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a problem in this scenario: <myprefix:mycontrol runat="server"> <%= SomeVariable %> </myprefix:mycontrol>
14
14667
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control so I get the ObjectDataSource. No problem ..... ObjectDataSource src = .... //is ok i have it
15
6544
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
0
11063
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10790
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10390
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9535
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7098
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5960
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4580
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4176
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.