Textbox formating
I have a textbox on a form that I want to display the
entered data as a date, without the user having to use a
date seperator. I've tried user-defined date formats and
user-defined number formats(to insert the seperator). But
the text always changes to the style string instead of
converting to the style string as follows:
TextBox1.Text = Format(Textbox1.Text, "MM,dd,yyyy") Tag: Deploy ODBC connection Tag: 64129
form control validation error and focus
Hi, I have a problem as below:
* The form control is TextBox.
* Method: textBox1_Validating(...)
* When a validation error occurs, the focus stays.
* If I can not find the valid data, and I want to cancel.
* I do not know how. Please advise. Thanks.
Peter Tag: Deploy ODBC connection Tag: 64128
Load event firing twice for one form instance
I have a form which I want to show modally; it's a fairly old form
that's been ported up several versions of VB, and I'd like to keep its
rewriting to a minimum. Basically, it is used in this sequence:
1. The form is shown. The Form_Load event does some initialization.
2. Further parameters are passed to this form.
3. We actually need this form to be modal, so we hide it and show it
again modally.
4. Stuff happens on the form based on the parameters passed in, etc.
(The VB.NET code for this is below.) However, I've discovered that
calling ShowDialog() in step #3 fires off the Form_Load event a second
time, even though it's the same object instance. Does any instance of
showing a form fire this event?
(My problem here is that the Form_Load initialization should only
happen once. I could use an already_initialized flag, but that's
horribly messy; if I have to, I'd rather pass Foo in the constructor
and hold onto it through the Form_Load process.)
--Caitlin Shaw
**Code**
Private WithEvents frmThing As ThingForm
Public Sub DoThatThingWithFoo(Foo as Object)
'Create the thing and set it up
frmThing = New ThingForm()
frmThing.Show()
frmThing.DoSomeSetup(Foo)
'Really, though, we want this thing to be modal
frmThing.Hide()
frmThing.ShowDialog()
'Good, that's done
frmThing.Dispose()
End Sub Tag: Deploy ODBC connection Tag: 64125
MouseLeave does not work !
Hi,
I designed a usercontrol and I assigned a handler to the MouseLeave
event !
It fires 80% of the time but when you manage to move your mouse very
fast out of the control it does not !
Does someone know a workaround ?
Arkam Tag: Deploy ODBC connection Tag: 64120
NotifyIcon is greyscale under Windows 2000
Doing developing under Windows XP,VS.NET 2003,.NET 1.1 Framework.
Assign notifyIcon an icon *.ico file. Appears fine (color) in task tray when
running under windows XP.
When I run on Win 2000 test machine with .NET 1.1 Framework installed, the
app runs fine but the task tray icon is greyscale, rather than color.
Thinking it was some glitch with this particular icon, I've tried dozens of
different icons (from inside shell32.dll) with the same results. Anybody
have any idea what this is? Tag: Deploy ODBC connection Tag: 64117
Yet another No Touch Deployment Issue
Hi,
I am writing an application that has to be run via a web browser and it also
must run using the default security settings for an internet application
(Framework 1.1). Which is the lowest setting.
Part of the Design Specs is that each user's preferences are saved. I
thought about using Isolated Storage for this and saving the User's Settings
to a xml config file, but I can't save to Isolated Storage with the Default
Security Settings. Does anyone have any other suggestions I can try? I
know I can store the info on the web server as well and access via a
WebService, but I was hoping for a way to accomplish this without storing
the information on the Server.
TIA,
--
Paul Tag: Deploy ODBC connection Tag: 64116
Problem with OCX component: property OcxState not setuped
Hi I have a Ocx developed in V.B. 6 and I'm trying tu use
it in C# application but during the InitializeComponent()
method I get an Exception:
'System.Resources.MissingManifestResourceException' en
mscorlib.dll
Aditional information: Could not find any resources
appropriate for the specified culture (or the neutral
culture) in the given assembly. Make
sure "frmKernel.resources" was correctly embedded or
linked into assembly "Kernel".
This is the code that it try to execute:
this.axMonitorSend1.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject
("axMonitorSend1.OcxState")));
Please help me
Regards Tag: Deploy ODBC connection Tag: 64115
adding items to forms' resource files
Please let me know if there is a better way to do this.
I have set the Localizable property of my forms to true,
meaning of course that it will persist the properties of
the controls of my forms in the resource file for that
form. But my question is, how do I add additional
properties for that form to the resource file? For
instance, I have error messages, tooltips, log messages,
etc., associated with each form. It makes sense to me to
be able to add those to the form's resource file and then
to be able to reference them from within code (using the
resource variable that VS generates). However when I add
them, after I make changes to the form in Visual Studio,
the items I added are gone.
I am aware that I can create a new resource file and
reference from there but I'd like to avoid that since
there is already a resource file for each form created.
Thanks for any tips,
Andrew Tag: Deploy ODBC connection Tag: 64113
Standard and other toolbar icons/bitmaps
I'm being dead thick, but I can't get my head around
this:
Where can I get standard toolbar icons like Open, Save,
Print etc from? Should I embed them in my app or can I
assume that any system will have them? How does each
version of WIndows differ - do I need to know what
version the user is running and pick icons accordingly?
I've pulled a bunch of other icons from dlls, and want to
use some. However they have white backgrounds both in the
Image Editor and when displayed. The host ImageList
TransparentColor property doesn't make a difference.
Changing the bitmap background from Opaque to Transparent
doesn't make a difference.
There's nothing in any of the .NET books I have, and I
can't find anything online. What am I missing? Tag: Deploy ODBC connection Tag: 64108
Use an Ocx
Hi
I have an ocx developed in VB 6.0 and I nedd to use it in
Window Form application in C#. When I do it, I get a
System.NullReferenceException
I've added the reference and in my application I wrote:
//Global Variables
Monitorsdn.MonitorSendClass sendMon = null;
short local = 0, remoto = 0;
string socket = "C", sPath = "C:\mon.ini"
public myForm() {
InitializeComponent();
InitializeOcx();
}
private void InicializeOcx() {
short shEvent = 1;
sendMon.Monitor(ref shEvent, ref local, ref remoto, ref
socket, ref sPath);
}
Do I need do or include something else??
What's wrong???
J.C. Tag: Deploy ODBC connection Tag: 64107
How to do SMS in window application?
Hi,
I am currently working on mobile application, and I am try to implement SMS
(text message) into my window desktop application. Add codes to VB app and
sent
SMS to Smartphone device as a notification message.
What api or dll do I have to use in VB app.?
I know that there is a SMS lib in mobile platform, but not in window appl.
Please help. thank you Tag: Deploy ODBC connection Tag: 64103
ReadOnly DataGrid
Hi,
I want to create a readonly grid.
By this I mean that none of the cells should be editable.
At the moment I have set the readonly property of the grid
to true.
This is OK for 'DataGridBoolColumn' i.e. columns
displaying checkboxes, but for DataGridTextBoxColumn, the
background is greyed out, and a cursor starts blinking in
the cell.
I don't want this cursor to appear at all, and the whole
grid line shuld appear as if the user had clicked the row
header.
I thought there would be an easy way of doing this?
Cheers
Fred. Tag: Deploy ODBC connection Tag: 64094
Calling Dispose on form variables.
Hello All,
I've a doubt regarding calling Dispose() method on the
controls of a form.
I've a simple MDI form. On a click of a menuItem I
instantiate a new modeless form. As per a prior message
posted
(http://blogs.gotdotnet.com/rprabhu/permalink.aspx/af94ee11
-5488-4ff0-bd5b-d7b41a0d0ebf), modeless forms are disposed
whenever they are closed. This is also happening in my
case as the dispose method is being called. So far so good.
But I noticed that the code to call Dispose() for all the
controls in this modeless form is not generated by VS.
Only some of the controls(e.g. System.Windows.Forms.Timer)
which are being added to 'IContainer components' member
variable of the forms are being Disposed. Rest for all
other controls, I've to call the Dispose method manually.
I've no problems in doing this, but I wanted to know why
this is done?
The controls in this modeless form are custom control and
all implement a common application specific interface.
When I try to call their Dispose methods, some of the
controls throw this exception
Exception : "InvalidOperationExcepiton"
Message : Cannot call Invoke or InvokeAsync on a control
until the window handle has been created.
StacKTrace : at
System.Windows.Forms.Control.MarshaledInvoke(Control
caller, Delegate method, Object[] args, Boolean
synchronous)
at System.Windows.Forms.Control.BeginInvoke(Delegate
method, Object[] args)
at System.Windows.Forms.Control.BeginInvoke(Delegate
method)
at System.Windows.Forms.DataGrid.OnLeave(EventArgs e)
at System.Windows.Forms.Control.NotifyLeave()
at
System.Windows.Forms.ContainerControl.UpdateFocusedControl
()
I'm not able to make it out, what this exception is, and
how can I handle.
Can anyone help me out in both of my doubts?
Thanx in Advance.
Mahesh. Tag: Deploy ODBC connection Tag: 64093
Suggestion: a default ListViewItemComparer in System.Windows.Forms
Would be nice to have a default ListViewItemComparer ;-)
come on framework guys ;-)
probably an oversight but lets fix it and get a simple default comparer into
v1.2?
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformslistviewclasscolumnclicktopic.asp?frame=true
--
Eric Newton
C#/ASP Application Developer
http://ensoft-software.com/
eric@cc.ensoft-software.com [remove the first "CC."] Tag: Deploy ODBC connection Tag: 64090
New cool software
Hi guys,
Check out this software I found on the net...
http://www.dualdot.net/default.asp?nav=imagebatch
It's called ImageBatch and has a batch mode for converting, naming and
resizing images...
It's very cool! Tag: Deploy ODBC connection Tag: 64087
Instance Forms
I'm starting with vb.net, and i already come across with
some problens.
i have three forms.
The start form is form1.vb, and it have two buttons.
Button1 shows Form2.vb, and button2 shows Form3.vb.
I've place the instance of the two forms into the main
body of the form (i.e. outside any Subs, Events or
Methods):
Dim F2 as new Form2
Dim F3 as new Form3
If i do this and try to run the project the main form
doesn't appear.
If i only instance a form, the main form appear when i
run the project.
Theres any one who can help me.
Thank you all.
Ana Rita Tag: Deploy ODBC connection Tag: 64078
Populating Dataset from xml fil
I have an XML file which has elements with nodes. I can
load this XML file into a .NET xml document and then
populate a dataset with it.
Since this xml file has nesting (only 1 level, like master-
detail relationship) so can I populate 1 datatable with
the parent elements and another datatable with the child
nodes.
Please provide some information on this. Any pointers or
code will be appreciated.
Thanks
neel Tag: Deploy ODBC connection Tag: 64077
Event bubbling in windows forms?
Hi
If an event (such as a click on a button) is not handled
by that button class, is it not passed to the containing
window, (say the form) so it can be handled there?
I basically have a form with 30 small buttons on and wish
to have one generic handler for the button clicks.
Thanks
John. Tag: Deploy ODBC connection Tag: 64073
Create new event handler or override existing handler?
While developing on windows forms, I found that most forms events (e.g. Load, KeyPress, MouseMove, LostFocus, etc....) have the equivalent virtual functions in the form of OnXXXX which can be overwritten. If I want to handle the KeyPress event, is it recommended to create an event handler in the constructor,
this.KeyPress += new KeyPressEventHandler(form1_KeyPress);
or to override the OnKeyPress virtual function?
I have tested both ways and didn't find any substantial differences between them. Is there any guideline to follow on which method to use? Tag: Deploy ODBC connection Tag: 64070
Dynamic Menu Query
Hi ,
My requirement is to create menu dynamically based on
user permissions.
So I had decided to have the details about menu in a xml
form. Now I had also go few article which does something
similar to this.
In this below article menu is been built from a database
table.
http://www.codeproject.com/cs/menu/csdynmenudemo.asp
Any one got this kind of component? Any clues?
Thanks and Regards,
Sachi Tag: Deploy ODBC connection Tag: 64068
Drawing on the desktop
I'm writing a docking window control, and need to write on the
desktop, so I can show a candidate dock rectangle on top of the dock
manager's child controls.
I found
[DllImport("user32.dll")]
private static extern IntPtr GetDesktopWindow();
and
[DllImport("user32.dll")]
private static extern IntPtr GetShellWindow();
but when I do
IntPtr Handle = DesktopWindow();
Graphics Desktop = Graphics.FromHdc(Handle);
Desktop.ReleaseHdc(Handle);
private IntPtr DesktopWindow()
{
IntPtr Result = GetShellWindow();
if (Result != IntPtr.Zero)
return Result;
return GetDesktopWindow();
}
in an OnPaint or OnMouseMove handler, I get an "Out of memory"
exception - even when I don't draw anything!
Google shows me that others have this problem - but doesn't show me a
solution ....
--
programmer, author http://www.midnightbeach.com
and father http://www.midnightbeach.com/hs Tag: Deploy ODBC connection Tag: 64066
UserControl
Hello,
I have a component derived from System.Windows.Forms.UserControl and I
want it to show vertical scroll bar all the time. I tried to set:
this.VScroll = true;
but it didn't have any effect.
Any help would be appreciated.
Thank you. Tag: Deploy ODBC connection Tag: 64065
No Touch Deployment and Win 2003 Server?
We're testing our Winforms app on Windows 2003 server. For
previous servers we had to remove the .config file mapping
so the machine config could be downloaded by the
application. In Win 2K3 Server no file can be downloaded
unless there is a mapping for it, which creates a problem.
Anyone know how to configure Win2k3 Server to work with a
no touch deployment and get the machine config file
downloaded?
Thanks in advance.
--
Dave Tag: Deploy ODBC connection Tag: 64064
Why it is not painting classes that are directly inheriting from Control class.
I want to make custom control. The problem is, i want to inherit from
System.Windows.Forms.Control class not System.Windows.Forms.CustomControl.
Although i have overriden the method OnPaint in my class and draw something
inside it, it doesnt draw in the main form that i add my custom control.
public class MyCustomControl : System.Windows.Forms.Control
{
protected override void OnPaint (PaintEventArgs e)
{
base.OnPaint (e);
e.Graphics.DrawRectangle (new
System.Drawing.Pen(System.Drawing.Color.Red,2),0,0,this.Width,this.Height);
}
}
It doesnt enter the OnPaint method. But if i change the base class to
UserControl, it draws my custom control. Can anyone explain this to me,
please.. Tag: Deploy ODBC connection Tag: 64059
Text Box Behavior
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C3D255.BEE88B30
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
All,
I have a couple of forms that have a strange textbox behavior. In all =
the text boxes, even if I add a new one, I can not set the caret =
anywhere in it except in 0. It will select whole words and if I have =
the caret at 0, I can use the arrow keys to move the caret. Everything =
else seems to be fine. I can't find any property that makes the textbox =
back to normal. Can someone tell me what I turned on or off to cause =
this behavior?
Regards,=20
Brian P. Hammer
------=_NextPart_000_0008_01C3D255.BEE88B30
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>All,</DIV>
<DIV> </DIV>
<DIV>I have a couple of forms that have a strange textbox =
behavior. In all=20
the text boxes, even if I add a new one, I can not set the caret =
anywhere in it=20
except in 0. It will select whole words and if I have the caret at =
0, I=20
can use the arrow keys to move the caret. Everything else seems to =
be=20
fine. I can't find any property that makes the textbox back to=20
normal. Can someone tell me what I turned on or off to cause this=20
behavior?</DIV>
<DIV> </DIV>
<DIV>Regards, <BR>Brian P. Hammer</DIV></BODY></HTML>
------=_NextPart_000_0008_01C3D255.BEE88B30-- Tag: Deploy ODBC connection Tag: 64052
No-Touch Deployment security problem
I wrote a NTD winform application. It checks links on any website to
see if they are good. You can find it here:
http://ntd.didah.com/
It works fine on my local machine of course. But when deployed to the
internet it throws this security exception:
System.Security.SecurityException: Request for the permission of type
System.Net.WebPermission, System, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 failed.
at System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
PermissionToken permToken)
I stuck a textbox in there so you can see the Exception.
Apparently NTD apps aren't allowed to use the Internet??? This is not
cool! Is there a fix for this?
Also the application icon gets lost.
Is there a way to remedy these problems?
Thanks for your help. Tag: Deploy ODBC connection Tag: 64049
VC++ .NET 2002
I looked everywhere through MSDN without any luck.
Considering that the 2002 version does not have the
Windows Form Designer, then how does one go about using
windows forms in VC++ .NET 2002? I don't mind handcoding
everything in but I need some reference to do so. Does
anybody know how to approach this? Thanks.
SimonK Tag: Deploy ODBC connection Tag: 64045
MDI Container and BackColor Problem
If I set my form's IsMdiContainer property to TRUE at
design time, the form's BackColor automatically changes to
a dark gray. Setting the BackColor property to something
else has no effect.
If I set IsMdiContainer property to FALSE, I can control
the BackColor both at design time and runtime. But adding
the following to the form's load method:
Me.IsMdiContainer = True
causes the form to revert back to the dark gray at
runtime. Including something like
Me.BackColor = System.Drawing.Color.LightGray
has no effect.
Since no one has raised this question here, I must be
missing something pretty obvious. How can I control my
MDI container form's BackColor?
Thanks,
Tom Tag: Deploy ODBC connection Tag: 64039
Can I write an object refence to file with one command? like a dataset.
I use VB7
I would like to know if I can write a dataset object or
any other object like textbox to file with a single
command. Or do I have to tear apart the objects and write
its properties to file?
What would be the code to write and read a completed
dataset with tables and rows data to a datafile on the
harddrive? Tag: Deploy ODBC connection Tag: 64028
Closing Event
Windows Forms provides a Closing event that the form being
closed can cancel. It seems clear for modal dialogs but
not for modeless forms.
The method Close() on the form causes the event to occur
but doesn't return a value. How can the element doing the
closing know the form didn't want to be closed?
I'm trying to implement permissions where each form can
determine whether it can be closed normally.
Clyde Tag: Deploy ODBC connection Tag: 64024
Maximum Picture Box width
Hi,
.Net documentation says that the datatype of picture box
width and height are Int32 then why can't we assign
Int32.MaxValue (2,147,483,647) to width and height of the
picture box.
Similarly,
When we create a bitmap having the following dimension
Bitmap bmp = new Bitmap(Int32.MaxValue, Int32.MaxValue );
It gives as exception.
Does it mean that the width of the control and bitmap are
in short int ?
Regards
Kapil Tag: Deploy ODBC connection Tag: 64023
Suppress Display of Specific Items in Component Tray?
This is a multi-part message in MIME format.
------=_NextPart_000_000C_01C3D175.917EC910
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
What determines whether a given object appears in the Component Tray of =
a Windows form? How can I get an item that is displaying there to stop =
displaying, without deleting it altogether?
Background:
I created a form using the DataForm wizard so I could take advantage of =
some of the code that generates. I then wanted to change all the OleDb =
objects to the corresponding SqlClient objects, and was able to do so =
successfully using global edits on the the "Windows Form Designer =
generated code" region. =20
I then renamed all the object variables that began with "OleDb", which =
turned out to be all command objects (formerly OleDb command objects, =
now SqlClient command objects).
After changing the names of these command object variables, some of the =
affected objects showed up in the component tray as discrete items. =
Some didn't. I'm not seeing in the code anything that would indicate =
why some show up and others don't. But I don't want any of the command =
objects to show up as discrete items in the component tray, as I can get =
at them through the properties of the DataAdapters to which they are =
attached.
Help appreciated!
--=20
Greg Dunn
------=_NextPart_000_000C_01C3D175.917EC910
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>What determines whether a given object =
appears in=20
the Component Tray of a Windows form? How can I get an item that =
is=20
displaying there to stop displaying, without deleting it=20
altogether?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Background:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I created a form using the DataForm =
wizard so I=20
could take advantage of some of the code that generates. I then =
wanted to=20
change all the OleDb objects to the corresponding SqlClient objects, and =
was=20
able to do so successfully using global edits on the the "Windows Form =
Designer=20
generated code" region. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I then renamed all the object variables =
that began=20
with "OleDb", which turned out to be all command objects (formerly OleDb =
command=20
objects, now SqlClient command objects).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>After changing the names of these =
command object=20
variables, some of the affected objects showed up in the component tray =
as=20
discrete items. Some didn't. I'm not seeing in the code =
anything=20
that would indicate why some show up and others don't. But I don't =
want=20
any of the command objects to show up as discrete items in the component =
tray,=20
as I can get at them through the properties of the DataAdapters to which =
they=20
are attached.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Help appreciated!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>-- <BR>Greg Dunn</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_000C_01C3D175.917EC910-- Tag: Deploy ODBC connection Tag: 64021
Datagrid
I am developing a UI that will be mainly keyboard driven.
I have a datagrid that needs to return a value when the
user hits the 'Return' button.
I have tried the keypress, keydown, and keyup events at
the datagrid as well as at form level, but have not
succeeded in being able to return the value of the current
cell.
Anyone help would be greatly appricated. Tag: Deploy ODBC connection Tag: 64020
Closing modeless form causes parent form to disappear (or lose focus).
Jazzyfoot (jazzyfoot@hotmail.com) posted this message at 2003-02-11
15:40:00 PST:
"The problem occurs when my application creates multiple modeless
forms. What happens is that when these forms are closed focus changes
from the parent application to the last application which had focus
(e.g. Visual Studio .NET).
Here are the steps to reproduce the problem (using the application
below)...
1. Create a modeless form, set it's owner, and call Show() - (click
modeless).
2. Create a second modeless form, set it's owner, and call Show() -
(click modeless, the first form may require moving in order to be able
to click the button again).
3. Close the first modeless form using the X in the top right corner.
4. Close the second modeless form using the X in the top right corner.
After performing step 4 the parent form disappears and whatever
application had focus before my test application is activated.
Here is some code to illustrate the problem...
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace ModelessForm
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
} base.Dispose( disposing );
}
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(48, 32);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "Modeless";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.AddRange(new System.Windows.Forms.Control[]
{this.button1});
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
ModelessForm newForm = new ModelessForm();
newForm.Owner = this;
newForm.Show();
}
}
public class ModelessForm : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
public ModelessForm()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
} base.Dispose( disposing );
}
private void InitializeComponent()
{
//
// ModelessForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(272, 198);
this.FormBorderStyle =
System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Name = "ModelessForm";
this.ShowInTaskbar = false;
this.Text = "ModelessForm";
}
}
}"
He didn't get any replies. I have the same problem and want to know if
there is a solution.
Thanks, Marcus Tag: Deploy ODBC connection Tag: 64017
Newbie: How to do New Record Question
Hi All,
New here to .NET and am having difficulty conceptually understanding how one would use Datasets and have an empty form open up ready for data input. It seems like all of the examples I've found are related to showing how to display existing data in a grid (lots of examples here), or set bindings to controls on a form and then display the associated data.
What's lacking however in the many examples I've found is having a databound form that opens up empty and the user can then start enter data into it. Seems my understanding at this point is all about loading up that dataset for display, but for a new record, I really haven't done any kind of dataset loading yet, have I?
If some kind guru could point me in the right direction or share a resource that I can study to get this figured out, I'd be greatly appreciative.
Thanks..Bob
Bob McCormick Tag: Deploy ODBC connection Tag: 64015
freeze when launching form from c# dll
When I launch a form from a c# dll (part of the c# project), after I do a
show the launched form freezes. If the dll host launches the same form from
an exposed public method in the c# dll project then no problems.
Is there anyway I can launch the windows form that is part of my c# project
with out it "freezing".
Thanks,
John Dolinka Tag: Deploy ODBC connection Tag: 64011
binding custom business entity components
I want to create a custom business entity that encapsulates my data and its logic. I want to be able to user the designer within VS to bind visual control fields to my data fields. What all do I need to do? Is there a book that covers this? Tag: Deploy ODBC connection Tag: 64008
RichTextBox SelectionTab problem
Hi all. I've seen examples on how to measure average
character width with StringFormat.GenericTypographic and
how to set the SelectionTab array, but the problem is, even
with fixed size font (Courier New in my case), the tab
width is off by 1 or 2 pixels, depending on font size.
Seems to me it's not rounding problem... Anyone has a
better idea?
Here's my code:
public static void SetTabSize(RichTextBox rtb, int nChar) {
int tabsz = (int)((aveCharWidth(rtb.CreateGraphics(),
rtb.Font) * (Char));
System.Diagnostics.Debug.WriteLine(tabsz);
int[] tabs = new int[32];
tabs[0] = tabsz;
for(int i=1; i<tabs.Length; i++) {
tabs[i] = tabs[i-1] + tabsz;
}
rtb.SelectionTabs = tabs;
}
private static float aveCharWidth(Graphics g, Font f) {
string str =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
return g.MeasureString(str, f, 0,
StringFormat.GenericTypographic).Width / str.Length;
} Tag: Deploy ODBC connection Tag: 64007
add item to listbox
Hey group!
first of all, happy new year to everyone.
I have a small problem that I haven't worked out yet and it's driving me a
little crazy.
I have two forms with a listbox control on each one.
the child form passes the selecteditem to the parent form.
but I want to pass the whole item (Value Member, Display Member) and I have
no clue on how to do this.
what I could do was to pass just the text as a parameter in an event on the
child form.
but that doesn't suit my needs.
I can't use databindings, because I need to do this manually.
is there a way to add the whole item????
thanx in advance!
ignacio martínez
buenos aires, argentina. Tag: Deploy ODBC connection Tag: 63999
mdi child minimize
hi,
i'm working with an mdi application in which i have several mdi children
open. as i minimize these children they are visible in the lower left hand
corner of the screen on top of the mdi parent form. however, each of these
mdi children have been minimized to the point that they're about the size of
the close button. I can see that the control box icon is still present, but
it is actually located underneath the close button, relegating my minimized
form to a small square. in previous endeavors with mdi, the child form is
typically placed in a similar position, but there's usually titlebar text
visible and the minimized windows are of a standard width/height etc.
has anyone else seen this?
is this default behavior?
am i supposed to be manually setting the height and width when the child
form is minimized (i've actually tried doing this and it didn't work as it
seems the minimize function resizes it itself wiping out my settings)?
i can attatch a screen shot for your reference if necessary.
vs.net 2003
framework 1.1
thanks,
jim Tag: Deploy ODBC connection Tag: 63996
TreeView updating a Node! What am I missing here?
What am I missing in my understanding of updating a node
in a Treeview?
If I create a new node and then try to assign it into
the node a particular index position within the TreeView
Nodes collection I am getting duplicate nodes. If I
remove the node and then replace it then that works ok.
Eg. When I use TreeView.Nodes[index] = Node
Gives me two nodes on the TreeView.
It works ok if I delete it and add.
What stupid obvious thing am I doing wrong here?
Thanks..
The routines...
private void button1_Click(object sender,
System.EventArgs e)
{
//This is adding two nodes??????
//
// int index = treeView1.Nodes.IndexOf
(registeredDataSets_Node);
// registeredDataSets_Node =
AddNode_RegisteredDataSets();
// treeView1.Nodes[index] = registeredDataSets_Node;
//This also is adding two nodes??????
//
//int index = treeView1.Nodes.IndexOf
(registeredDataSets_Node);
//treeView1.Nodes[index] = AddNode_RegisteredDataSets();
//registeredDataSets_Node = treeView1.Nodes[index];
//This Works
treeView1.Nodes.Remove(registeredDataSets_Node);
registeredDataSets_Node = AddNode_RegisteredDataSets();
treeView1.Nodes.Add(registeredDataSets_Node);
}
private TreeNode AddNode_RegisteredDataSets()
{
TreeNode node = new TreeNode("DataSets");
for (int x = 1; x < 5; x++)
{
node.Nodes.Add(new TreeNode( "DataSet"+x.ToString() ) );
}
return node;
} Tag: Deploy ODBC connection Tag: 63994
Hide Caret in richTextBox Control
Greetings,
How can I disable the blinking cursor (called a caret?) in
a richTextBox control in C++ .NET? I found a command for
MFC called HideCaret, but I'd like to do this in Windows
Forms.
Any help would be greatly appreciated!
Thanks,
Kevin Tag: Deploy ODBC connection Tag: 63982
Programmatically setting BackColor
Hi,
I am using managed C++ and want to programmatically set the forms BackColor
from either four values (A,R,G, B) or one value ARGB. I tried putting this
is the form's load method:
Color clr;
clr.FromArgb(ARGB);
this->BackColor = clr;
It compiles and runs but the color doesn't change. Any ideas or better ways
of doing this?
Thank you,
Joe Tag: Deploy ODBC connection Tag: 63979
SHIFT to Open
Hi,
does anyone know how to intercept the SHIFT key while opening a vb.net or C#
windowsforms application?
I would like to do something like MS Access when excluding autoexec macros.
thanks
Alberto Tag: Deploy ODBC connection Tag: 63977
Repeated Adding,Removing control from form
I have included a snippet below which illustrates the
problem with adding and removing controls in a repeating
fashion. At least on my computer (Windows XP) the
program crashes after several thousand iterations. Is
there a way to correct this simple program so it doesn't
crash or is there a bug with .NET 1.1?
Thanks, Brad
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.IO;
using CustomDialogs;
using CustomControls;
using System.Threading;
public class Test{
public class MyForm:Form{
XButton button = new XButton();
XButton test = new XButton();
int count;
public MyForm(): base() {
InitializeComponent();
}
private void InitializeComponent(){
this.Width = 1000;
this.Height = 900;
this.Controls.Add(button);
button.Click +=
new EventHandler(click);
test.Location = new Point(300,300);
}
void click (object sender, EventArgs e){
for (int i = 0;i<30000;i++){
Controls.Add(test);
Controls.Remove(test);
count++;
button.Text = count.ToString();
button.Refresh();
}
}
}
public static void Main(string[] args)
{
MyForm form = new MyForm();
Application.Run(form);
}
} Tag: Deploy ODBC connection Tag: 63973
Another PropertyGrid Question
The grid happily shows any public properties that has the Browsable
attribute set, but if I inherit public properties from some base class and
base my property grid on the new class, the property grid shows base class
properties but displays "Object reference not set to an instance of an
object" for them all - it only shows the additional public properties in my
new class correctly. Can anything be done about this ? Tag: Deploy ODBC connection Tag: 63972