New Form Goes Behind Main Form when clicked.
I have a main form and from it i am creating and showing a new form using
the Show method. The form does not have an owner.
It correctly appears on top of the main form but when i click it it goes
behind the main form. If I then go bring the form to the front
it is fine from that point forward. It is just the initial click after
creation.
I believe I have done what I describe here successfully in several apps
before but I cannot figure out what is wrong here. Does anyone have any
thoughts? Tag: GroupBox... Tag: 88080
Problem Creating Handle
I have a UserControl that contains a few ComboBoxes and TextBoxes. For most
of the Controls/Forms that I drop this on, I'm not having any problems at
all. One form, however, is giving me problems and it seems to be crashing in
the CreateHandle method. I have put a breakpoint in the HandleCreated event
of my UserControl, but it's never hitting it cuz it crashes before that. It's
obviously having a problem creating the handle and I'm trying to figure out
why.
Does anybody know what event fires prior to the HandleCreated event? If I
can set a breakpoint there maybe I can figure out what the problem is.
TIA,
~~Bonnie Tag: GroupBox... Tag: 88079
How Best to Move From Form to Form
I've been a Web Developer for about 5 years, but am now being asked to write
a Forms based application. My basic question is how best to move from form
to form. I've read about MDI, ShowDialog, Form.Show(), and even just setting
various forms from Visible = True to Visible = False. I guess, I'm a bit
confused as to which would be the best implementation.
Just to give a few details on my project...
I will have a login screen, then once the user logs in I will have a main
screen. Depending on the options selected on the main screen, the user will
either be directed to a Delete Screen or a Copy Screen. The Delete Screen
and the Copy screen really do nothing more than inform the user of actions
taking place in a database. Basically just a logging/status screen. I know
I'll need to implement threading for this, but I'm not sure how best to move
from screen to screen.
Thanks. Tag: GroupBox... Tag: 88075
Some (not so?) general questions...
Hi all.
I'm primarly a C++ developer but I've been trying to complete development on
a C# application with the following basic requirements:
- The app runs in the background is initially hidden from the user,
including the Windows Taskbar.
- The app needs to receive a registered Windows message
- The app needs to "register" its window handle with an unmanaged C++ dll so
that a WM_USER message can be sent back to the C# app's WndProc
- The app needs to display itself when receiving the WM_USER message, and
hide itself after being acted upon by the user.
I ran into some problems along the way and wondered if anyone could provide
some feedback or comments. Especially since I told my project guy this
should be trivial to do in C#, and now I'm wondering if I made the correct
decision. I'm not looking good at this point.
1) In order to hide the app from the Taskbar, the main form's ShowInTaskbar
property would be set to "false", easy right? That action, however, (using
SPY++)removes the WS_APPLICATION style bit and prevents the application from
receiving any registered Windows messages.
2) I initially call a C#-to-C++ wrapper function to give my ".Handle" to the
unmanaged dll. This works for the first time, but when I set the main form's
Visible property to false and minimize the form, "Handle" gets a new value.
Is there some other "handle" I should be using? I work around this by
"re-registering" with the unmanaged dll after minimizing but there have been
a couple of occasions where a zero has been logged. Using FindWindow() in
the unmanaged dll would be acceptable, is there a way to "register a unique
window class"? The window titlebar includes message specific data so the
title changes.
3) I have seen several instances where the main window was shown (Visible =
true), but with no controls on it. Using SPY++, I see the main window listed
with no child controls, and a "WindowsFormsParkingWindow" which contains all
the children for this form. The data on the controls is correct, but it's as
if they are just not on the right form.
4) I also intended for a Windows Service to start the application, which
works, but the application does not survive a user logoff. We have C++/MFC
applications which do a subclassing code trick to accomplish this but I've
not found an equivalent for C# apps.
http://support.microsoft.com/kb/q164166/
5) I have the main form's TopMost property set to true, and after 2 hrs. of
messing around, I discovered the tooltips are showing behind the form. This
is the case for XP as well as Win2k.
One unrelated thing:
1) Once in a while my VS.NET search function starts reporting something like
"no files found to search in". Strangely enough, when I press CTRL+SCROLL
LOCK it starts working again. Not a big deal once you know the trick.
I apologize if I've missed this information but I looked in the groups and
didn't see any real answers to these questions. I would greatly appreciate
any input as to whether some of this behavior falls in the category of
"that's just the way it is", or I'm not doing things correctly, or bugs to
be fixed, or need to look at workarounds. I'm using VS.NET 2003 and .NET
Framework v1.1 and the target OS is Win2k. Needless to say, I've been
frustrated to this point in creating what I "thought" to be a pretty simple
app. My fear (from a schedule standpoint) is that I have to start over in
C++. Thanks in advance for any comments or insults :- ).
- Brad Jones (not CodeGuru guy!) Tag: GroupBox... Tag: 88074
How to control the order in which individual child controls are rendered
Hello All,
I am creating an image browsing function within an application. As such, I
created a Thumbpanel control (shown below) which displays a collection of
thumbnails. Each thumbnail on that panel is also a custom control ( of a
class called Thumbnail) placed at a calculated location on the Thumbpanel.
It turns out to take 1+ seconds to construct and render each Thumbnail, so
in turn it takes MANY seconds to render the whole panel. Therefore I need
to force each Thumbnail to be rendered individually as they are constructed,
so that the user will not be confused by the frozen screen awaiting the
whole thing to render. I expected that the line:
thumb.Refresh();
... would force the thumb object (of type Thumbnail) to be rendered upon
that call. But that didn't do the job.
Can someone give my guidance on how to force rendering of the individual
child controls (Thumbnails) in the order I specify?
Thanks,
-- Bruce
-------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
namespace WTMWClient
{
/// <summary>
/// Summary description for ThumbPanel.
/// </summary>
public class ThumbPanel : System.Windows.Forms.Control
{
Assets m_Assets;
ArrayList m_Thumbnails;
bool m_Scrollable = false;
public delegate void ThumbPanelDoubleClickedHandler(object sender,
ThumbnailDoubleClickedEventArgs e);
public event ThumbPanelDoubleClickedHandler
ThumbPanelDoubleClickedEvent;
private System.ComponentModel.Container components = null;
public ThumbPanel()
{
InitializeComponent();
m_Assets = new Assets(); // Simply a default value so it will not
be null.
m_Thumbnails = new ArrayList();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}
~ThumbPanel()
{
// ~base();
foreach (Thumbnail thumb in m_Thumbnails)
{
thumb.Dispose();
}
}
#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 InitializeComponent()
{
//
// ThumbPanel
//
this.Dock = System.Windows.Forms.DockStyle.Fill;
}
#endregion
protected override void OnPaint(PaintEventArgs pe)
{
// TODO: Add custom paint code here
// Calling the base class OnPaint
base.OnPaint(pe);
}
protected override void OnResize(EventArgs e)
{
base.OnResize (e);
PlaceThumbnails( false );
}
/// <summary>
/// Place each thumbnail in its proper position. Assumption is that
/// each thumbnail has already be constructed and placed in the
/// m_Thumbnails collection before this call.
/// </summary>
protected void PlaceThumbnails( bool isFirstDrawOfThisSetOfThumnails )
{
// Remove all the old ones. (But, dont "dispose" them, since they
// are still instantiated and held in m_Thumbnails.)
this.Controls.Clear();
// Place each one in proper position....
int x, y;
x = y = 0;
if ( isFirstDrawOfThisSetOfThumnails )
{
m_Thumbnails.Clear();
Thumbnail thumb;
foreach (Asset asset in m_Assets)
{
thumb = new Thumbnail( asset );
m_Thumbnails.Add( thumb );
thumb.ThumbnailDoubleClickedEvent +=
new WTMWClient.Thumbnail.ThumbnailDoubleClickedHandler(
thumb_ThumbnailDoubleClickedEvent);
thumb.Location = new Point(x, y);
this.Controls.Add(thumb);
thumb.Refresh(); // I expected this to force rendering
here. No luck!!
x += thumb.Width;
if ( x > this.Width-thumb.Width )
{
x = 0;
y += thumb.Height;
}
}
}
else
{
// no need to instantiate individual Thumbnails in this case.
// Rather, just grab each from the m_Thumbnails collection.
foreach (Thumbnail thumb in m_Thumbnails)
{
thumb.Location = new Point(x, y);
this.Controls.Add(thumb);
x += thumb.Width;
if ( x > this.Width-thumb.Width )
{
x = 0;
y += thumb.Height;
}
thumb.Refresh();
}
}
}
/// <summary>
/// Assign an Assets collection to be spanned via a set of thumbnails
on the panel...
/// </summary>
public Assets AssetsSource
{
set
{
m_Assets = value;
if (m_Assets.Count == 0) return;
PlaceThumbnails( true );
}
} // Property: AssetsSource
protected void thumb_ThumbnailDoubleClickedEvent( object sender,
ThumbnailDoubleClickedEventArgs e)
{
// MessageBox.Show( "clicked on: " + e.Asset.FileName );
if ( ThumbPanelDoubleClickedEvent != null)
{
ThumbPanelDoubleClickedEvent( sender, e );
}
}
}
} Tag: GroupBox... Tag: 88072
Webbrowser control
Hi
I have a form with a WebBrowser on it. when i load a webpage in it wich
normally creates a new window for the clicked link i want this to show in a
window i create.
I can't find a way of how to get this done.
Does anybody have a sample or a link to a sample in C#
Greetings Andre Mens
andre.mens@bennekens.nl Tag: GroupBox... Tag: 88071
No clue why ShowDialog crashes....
This one has me completely baffled. I am calling ShowDialog on this
form, and it is about the simplest form in any application. The form
presents a multi-line text box for viewing, copying to clipboard, or
printing.
Maybe someone has ideas???
WoComMenuHandler is a context menu handler on the main form.
WoComMenuHandler instances frmTextView, sets properties, and then calls
frmTextView.ShowDialog and crashes as follows. There is no form load or
activated event coded.
WoComMenuHandler does this setup prior to ShowDialog sets properties, as
follows:
Dim frm As New frmTextEditor
frm.Editable = True
frm.DialogTitle = "WO " & WoNum.ToString & " Comments"
frm.TextContent = wo.Comments
If frm.ShowDialog(Me) = DialogResult.OK Then
...
The properties (used above) in frmTextView are pretty straight forward.
It doesn't crash setting these properties. It crashes on ShowDialog.
Public Property Editable() As Boolean
Get
Return Not tbText.ReadOnly
End Get
Set(ByVal Value As Boolean)
tbText.ReadOnly = Not Value
If tbText.ReadOnly Then
Me.btnOK.Text = "OK"
Me.btnCancel.Visible = False
Else
Me.btnOK.Text = "SAVE"
Me.btnCancel.Visible = True
End If
End Set
End Property
Public Property DialogTitle() As String
Get
Return Me.Text
End Get
Set(ByVal Value As String)
Me.Text = Value
End Set
End Property
Public Property TextContent() As String
' tbText is a multiline text box.
Get
Return tbText.Text
End Get
Set(ByVal Value As String)
tbText.Text = Value
tbText.SelectionLength = 0
End Set
End Property
The exception I see is as follows...
************** Exception Text **************
System.ArgumentException: Invalid parameter used.
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height,
PixelFormat format)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
at System.Drawing.Icon.ToBitmap()
at System.Windows.Forms.ThreadExceptionDialog..ctor(Exception t)
at System.Windows.Forms.ThreadExceptionDialog..ctor(Exception t)
at System.Windows.Forms.ThreadContext.OnThreadException(Exception t)
at System.Windows.Forms.Control.WndProcException(Exception e)
at
System.Windows.Forms.ControlNativeWindow.OnThreadException(Exception e)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at PPSManager.frmMain.WoComMenuHandler(Object sender, EventArgs e)
at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
at System.Windows.Forms.MenuItemData.Execute()
at System.Windows.Forms.Command.Invoke()
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam) Tag: GroupBox... Tag: 88069
What direction to select?
(Since this ng was flooded I repost this Q.)
I declared a Form in Microsoft Visual Studio .NET 2003.
On the form there are buttons and progression bars and
three PictureBox in row, each showing a picture, later
a movie. The three PictureBox should always occupy the available
room when the form is resized (as much as reasonable) and
if one of them is more interesting, I want to be able to
size it larger covering the others. (A button press will
size all of them back to the regular arrangement.)
That is what I would like to do. (I could not find any examples yet.)
Should I program windows instead of PictureBoxes or I should be
able to use PictureBox?
Would it be possible to display the short movies (20-40sec long each)
in the PictureBox using a thread for each?
Thank you for any guidance. Tag: GroupBox... Tag: 88068
problems with multithreading, datasets and datagrids
I have a method that fills a dataset. Iâ??m calling this method asynchronously
using BeginInvoke. I put the dataset in an EventArgs derived class object and
pass that to another method. This second method switches back to the UI
thread and uses the data in the dataset to populate text boxes and datagrids
in the main form.
This always works fine the first time, and always freezes the app the second
time. One of the datagrids Iâ??m populating this way is visible and it always
gets a second scroll bar along the bottom the second time, it doesnâ??t get
filled and the app freezes. Iâ??m thinking dataset corruption but Iâ??m not sure.
When I change my asynchronous method call to a regular method call,
everything works fine.
I learned the technique I use from Chris Sellsâ?? article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms01232003.asp
I also own the book.
Iâ??ve used this technique successfully in a scenario that does not involve
dataset passing and datagrid loading. Any ideas?
EventArgs derived class:
public class VelocityArgs : EventArgs
{
internal BOOL Success;
public DataSet Ds;
internal VelocityArgs(){}
internal VelocityArgs(BOOL success)
{
Success = success;
}
internal VelocityArgs(DataSet ds)
{
Ds = ds;
}
internal VelocityArgs(BOOL success, DataSet ds)
{
Success = success;
Ds = ds;
}
}
Delegates for the 2 methods:
delegate void SnapDataDelegate();
delegate void PopTab_SnapDelegate(object sender, VelocityArgs v);
The asynchronous call:
private void btnRLSqlSnap_Click(object sender, System.EventArgs e)
{
if (velocity.SQLDataMgr.LoadState == velocity.LOADSTATE.DB_DATA)
{
// Asynch delegate method
SnapDataDelegate snapDataDelegate = new
SnapDataDelegate(SnapData);
snapDataDelegate.BeginInvoke(null, null); // calling SnapData
asynchronously
//SnapData(); // no problems this way (not asynchronous)
}
}
The method that is called asynchronously:
private void SnapData()
{
object sender = System.Threading.Thread.CurrentThread;
if (velocity.SQLDataMgr.LoadState == velocity.LOADSTATE.DB_DATA)
velocity.SQLDataMgr.GetSQLSnap.Run(velocity.SQLDataMgr.Connection);
velocity.SQLDataMgr.GetSQLSnap.LoadSpidStateHash();
VelocityArgs v = new
VelocityArgs(velocity.SQLDataMgr.GetSQLSnap.GetDataSet);
PopTab_Snap(sender, v);
}
PopTab_Snap switches back to the UI thread and populates the UI with the
datasetâ??s data:
private void PopTab_Snap(object sender, VelocityArgs v)
{
// Make sure we're on the right thread
if (this.InvokeRequired == false)
{
// skipping code that populates the textboxes
â?¦
DGR3Sessions.ColumnHeadersVisible = true;
if (v.Ds.Tables.Contains("Table2"))
{
DGR3Sessions.DataSource =
v.Ds.Tables["Table2"]; // freezes here
SizeCol(DGR3Sessions, "Table2", dotSpace);
}
â?¦
}
else // Transfer control to correct thread
{
PopTab_SnapDelegate popTab_Snap = new
PopTab_SnapDelegate(PopTab_Snap);
Invoke(popTab_Snap, new object[] { sender, v});
}
} Tag: GroupBox... Tag: 88067
TabPages hiding/showing changed in .NET Beta 2 or HOW ??
By now we all know it's a quite a job to hide/show tab pages on a tab control
... The workaround of adding (show) a removing (hide) pages to the tab
control seems to now only be a nice dream that I once had ???? This still
works fine in Beta 2 when the FORM that the tab control is on, is visible.
However, if the form is hidden I cannot use this code anymore !!! I don't
wan't to make a hidden form visible and then start manipulating the tab pages.
Anyone know a new workaround Tag: GroupBox... Tag: 88066
Bizarre keyup-events
Hi.
I've got this ListView with several items comparable to directories. Upon
key-up of Keys.Enter, I do a showDialog() of a login form. Pressing enter on
the login form (triggering its accept-button) also generates a key-event on
the listview.
Is this a bug or ... ?
Thanks,
Brecht Tag: GroupBox... Tag: 88065
Datagrid Issue
Hi,
I have a datagrid that I want to have a row highlighted when the mouse click
on any cell. I am able to accomplish it. But when I use the arrow keys to
move the cursor up/down I don't heve any row highlighted. Basically I want
to know what event is triggered when I move the up/down arrow keys so I can
highltght record.
Thanks for any help.
Sean Tag: GroupBox... Tag: 88058
decompression question
Hi there
I am using DeflateStream of System.IO.Compression to compress/decompress a
file. The compression works (apparently) well, but I can't get to decompress
it! I've tried everything, but the MSDN2 references use the MemoryStream
which isn't very intuitive for me.
Please help!
Best regards
Loane
My code is given below:
Imports System
Imports System.IO
Imports System.IO.Compression
Public Class DeflateCompress
Public Shared Sub Main()
' Names of original and compressed files
Dim filename As String = "C:\test\original.txt"
Dim filename_compressed As String = "C:\test\original.txt.zip"
' Open original (uncompressed) file as a filestream
Dim infile As FileStream = New FileStream(filename, FileMode.Open,
FileAccess.Read, FileShare.Read)
' Attempt to read filestream
Dim buffer(infile.Length - 1) As Byte
Dim count As Integer = infile.Read(buffer, 0, buffer.Length)
' Close filestream
infile.Close()
' Create new file to receive compressed stream
Dim ms_comp_create As New FileStream(filename_compressed,
FileMode.Create)
' Send stream of compressed data
Dim compressedzipStream As New DeflateStream(ms_comp_create,
CompressionMode.Compress, True)
' Write and close stream
compressedzipStream.Write(buffer, 0, buffer.Length)
compressedzipStream.Close()
End Sub
End Class
Imports System
Imports System.IO
Imports System.IO.Compression
Public Class DeflateDecompress
Public Shared Sub Main()
' Define compressed and decompressed file names
Dim strComp As String = "c:\test\compressed.txt"
Dim strDecomp As String = "c:\test\decompressed.txt"
' Open compressed file and create a filestream
Dim filComp As FileStream = New FileStream(strComp, FileMode.Open,
FileAccess.Read, FileShare.Read)
' Create a byte array equal in length to the compressed file
Dim bufComp(filComp.Length - 1) As Byte
' Read all bytes in the open file to the byte array
filComp.Read(bufComp, 0, bufComp.Length)
' Create a filestream to deposit the decompressed stream
Dim filDecomp As FileStream = New FileStream(strDecomp,
FileMode.Create)
' Decompress the contents of the compressed file
Dim zipStream As New DeflateStream(filComp,
CompressionMode.Decompress)
' Create a byte array greater in length than the compressed file
Dim bufDecomp(bufComp.Length + 100) As Byte
' Read compressed byte array into decompressed file
Dim offset As Integer = 0
Dim totalcount As Integer = 0
While True
Dim bytesRead As Integer = zipStream.Read(bufDecomp, offset, 100)
If bytesRead = 0 Then
Exit While
End If
offset += bytesRead
totalCount += bytesRead
End While
' Close the zipstream
zipStream.Close()
' Close files
filComp.Close()
filDecomp.Close()
End Sub
End Class Tag: GroupBox... Tag: 88048
DataGrid timestamp column
NOTE: I absolutely understand that a SQL Timestamp datatype
is not a Datetime. I've searched google, and the only hits
are poor sods that want to convert a Timestamp to a Datetime.
I want it to show as hex.
When I've got a column in a DataGrid that's a Timestamp, it
shows as "Byte[] Array" in the DataGrid.
What do I have to do to get this column to show as a hex
value like it does when I run a query in QA? I'm not finding
anything I can hook to do this.
Anyone? Tag: GroupBox... Tag: 88045
MDI application multiple controlboxes visible
I have a MDI application where the child forms have the controlbox property set to true, the forms open in normal state and autoscroll = true.
When multiple such child forms are open and even if one of them is maximised and then when tries to move between the various open forms via the windowlist an orphan controlbox is visible on the mdi.
As a result of which one can see multiple controlboxes even when one form is open.
Kindly do help me with since I am having a terrible time with this.
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>qJVvNaqrn0WoMtI/XSpjDA==</Id> Tag: GroupBox... Tag: 88044
Set time of time picker
(Type your message here)
I am using date time picker. I want to set the value of my choice in it . But not able to set the value of control. i hv set the property of SYSTEMTIME and send message DTM_SETSYSTEMTIME.
what shud i do now
Language evc++
--------------------------------
From: Neha yadav
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>ddOvH8rMQUO4H2zIlYth7w==</Id> Tag: GroupBox... Tag: 88043
Help with MessageBox.Show in SDk 1.1
I have installed the latest SDK 1=2E1 from Microsoft on my PC=
running Win2K OS=2E When I run the following program, it displays=
the MessageBox BUT DOES NOT show any text or anything on the=
button=2E I think it is supposed to dislay the text "Hello World!"=
and OK on the button=2E
Any help is greatly appreciated=2E
Here is the code:
/*
=09HelloWorld=2Ecs - First c# program
=09Compilation: csc HelloWorld=2Ecs
*/
using System;
using System=2EWindows=2EForms;
public class HelloWorld
{
=09public static void Main()
=09{
=09=09//Print Hello World
=09=09MessageBox=2EShow("Hello World !");
=09}
}
--------------------------------
From: mafat mafat
-----------------------
Posted by a user from =2ENET 247 (http://www=2Edotnet247=2Ecom/)
<Id>ER0meXW5Zk6777YqONKIzw=3D=3D</Id> Tag: GroupBox... Tag: 88042
Problem due to DPI Changes
Hi every One,
The problem i am facing has been handled previously by Mr=2EMarkus=
Wildgruber=2E The only difference was that he had used panels=2E My=
problem is that i am not using panels and when the DPI is=
changed the controls on the form get jumbled up=2E Can some body=
please address my problem and help me with a solutions as soon=
as possible=2E
It did be good enough if i can see to that the changes caused due=
to DPI dose not effect my applications and the settings of the=
application remain stable=2E Kindly inform me about any such=
property that controls the DPI changes=2E
Thank you
Vimal Adithya
--------------------------------
From: Vimal Adithya
-----------------------
Posted by a user from =2ENET 247 (http://www=2Edotnet247=2Ecom/)
<Id>9z6ovZdkW0SgHKqBU1cGdA=3D=3D</Id> Tag: GroupBox... Tag: 88041
setting icon when scrolling through applications using alt+tab
Hi there
I am using a fixed-dialog windows form since I don't want an icon to be
displayed, either on the form itself or on the task bar or status areas.
However, when I scroll through the running applications using Alt + Tab, I
get the generic executable icon. Can I change this to a custom icon?
Best regards
Loane Tag: GroupBox... Tag: 88039
Cannot access a disposed object named "DropDownHolder"
I have an application which uses the .Net PropertyGrid control. I haven't
encountered any special issues when running the application from the VS IDE.
However, users of the application hit several times (but seldom) the
following exception:
Message(s): Cannot access a disposed object named "DropDownHolder".
Object name: "DropDownHolder".
Some more details: The PropertyGrid is filled via a PropertyBag object (see
http://www.codeproject.com/cs/miscctrl/bending_property.asp) and the
application uses a DropDown converter to feed items with DropDown lists of
strings to the PropertyBag.
These exceptions happened after the main form of the application, which
contains the PropertyGrid control, was hidden for some time and then was
shown again and a dropdown item was clicked. I failed to reproduce this under
the IDE.
I basically understand what this exception means. However, I do not
understand what can be the reason for this exception.
The Call Stack of the exception follows below. Any explanation why this
happens and a suggestion for a workaround are most welcome.
--
Benzi
System.ObjectDisposedException: Cannot access a disposed object named
"DropDownHolder".
Object name: "DropDownHolder".
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at
System.Windows.Forms.PropertyGridInternal.PropertyGridView.DropDownControl(Control ctl)
at
System.Windows.Forms.PropertyGridInternal.PropertyGridView.PopupDialog(Int32
row)
at
System.Windows.Forms.PropertyGridInternal.PropertyGridView.OnBtnClick(Object
sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam) Tag: GroupBox... Tag: 88033
'Reference error' on second attempt to inherit form from DLL
Using C#.NET.2003 I'm running into a problem attempting to put
wrapper classes around managed Forms, and after six hours it's
getting hard to see whether it's a bug, bad documentation, or my
failure to understand the documentation. Any advice -- or comments
that can narrow my choices -- will be appreciated.
I'm writing a multi-form application whose form inheritance
structure I've already tried to lay out four or five times. Since
re-doing it is a real pain in the asterisk, I'd like to be able to
subclass the .NET managed Forms class several deep to cut down on
the time this takes to do.
Unfortunately, with my Latest'n'Greatest(tm) approach I keep running
into the following error message:
Reference error: Unable to reference 'MyDLL' to the current
application. Check that a different version of 'MyDLL' is not
already referenced.
Here's what I've tried to do:
In the MyDLL project I have:
class MyBaseForm : System.Windows.Forms.Form
class MyDbAccessForm: MyDLL.MyBaseForm
On this form I added a DataSet, an OleDbConnection, and
several DataAdapters.
Both of these are simple "wrapper" classes whose only purpose is to
leave a place for me to add changes later on as required.
I then tried creating a form frmMyMainForm in the MyApp project by
right-clicking on the project in Solutions Explorer and selecting
the Add->Inherited_Form option. When asked which reference I wanted
to add, I selected 'MyBaseForm' in 'MyDLL'.
So far, so good. The MyApp project now has a Reference entry
pointing it at MyDLL.
Then I attempt to add a second form -- frmMyDbBrowse -- to the MyApp
project using the same approach. Add->Inherited_Form, select the
'MyDbAccessForm' in 'MyDLL' as its ancestor, and... BOOM! A
'Reference error' message.
There seem to be very few reports of this particular error message,
and since I'm not attempting to inherit from an EXE file <grin>
those I've found don't appear to apply here.
Does anyone have any idea why this might be happening? I'm fairly
new to .NET, so there's lots of room for a Probable User error; if
so, can anyone suggest where I might be stumbling?
Frank McKenney, McKenney Associates
Richmond, Virginia / (804) 320-4887
Munged E-mail: frank uscore mckenney ayut minds pring dawt cahm (y'all)
--
Definition of an Upgrade: Take old bugs out, put new ones in.
-- Tag: GroupBox... Tag: 88032
Which way to go?
I declared a Form in Microsoft Visual Studio .NET 2003.
On the form there are buttons and progression bars and
three PictureBox in row, each showing a picture, later
a movie. The three PictureBox should always occupy the available
room when the form is resized (as much as reasonable) and
if one of them is more interesting, I want to be able to
size it larger covering the others. (A button press will
size all of them back to the regular arrangement.)
That is what I would like to do. (I could not find any examples yet.)
Should I program windows instead of PictureBoxes or I should be
able to use PictureBox?
Would it be possible to display the short movies (20-40sec long each)
in the PictureBox using a thread for each?
Thank you for any guidance. Tag: GroupBox... Tag: 88025
Error removing last item from a ListBox
I'm have a sample form, with a ListBox and a Remove button, I'm doing data
binding to a custom collection, everything is working find, I can bind the
list box, I can see the items appear on the list, I can remove items from the
list, BUT my problem is when I attempt to remove the last item on the list, I
get the following error:
System.ArgumentOutOfRangeException: Specified argument was out of the range
of valid values. Parameter name: Index was out of range. Must be
non-negative and less than the size of the collection
at
System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32
index)
at System.Windows.Forms.CurrencyManager.EndCurrentEdit()
at System.Windows.Forms.CurrencyManager.ChangeRecordState(Int32
newPosition, Boolean validating, Boolean endCurrentEdit, Boolean
firePositionChange, Boolean pullData)
at System.Windows.Forms.CurrencyManager.set_Position(Int32 value)
at System.Windows.Forms.ListBox.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.ListBox.WmReflectCommand(Message& m)
at System.Windows.Forms.ListBox.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
This is the source code I'm using (C#):
Collection.cs
public class Collection : System.Collections.CollectionBase
{
private Collection()
{
}
public static Collection NewCollection()
{
return new Collection();
}
public void Remove(CollectionItem item)
{
if (this.List.Contains(item))
this.List.Remove(item);
}
public int Add(string displayText, string valueText)
{
return this.List.Add(CollectionItem.NewCollectionItem(displayText,
valueText));
}
public CollectionItem this[int index]
{
get{return (CollectionItem)this.List[index];}
}
}
CollectionItem.cs
public class CollectionItem
{
private string _displayText = string.Empty;
private string _valueText = string.Empty;
public string DisplayText
{
get{return this._displayText;}
set{this._displayText = value;}
}
public string ValueText
{
get{return this._valueText;}
set{this._valueText = value;}
}
private CollectionItem(string displayText, string valueText)
{
this._displayText = displayText;
this._valueText = valueText;
}
public static CollectionItem NewCollectionItem(string displayText, string
valueText)
{
return new CollectionItem(displayText, valueText);
}
}
Form code:
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.ListBox lisItems;
private Collection items = Collection.NewCollection();
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
items.Add("One", "1");
items.Add("Two", "2");
items.Add("Three", "3");
this.lisItems.DataSource = items;
this.lisItems.DisplayMember = "DisplayText";
this.lisItems.ValueMember = "ValueText";
}
private void btnRemove_Click(object sender, System.EventArgs e)
{
if (this.lisItems.SelectedItem == null)
return;
CollectionItem item = (CollectionItem)this.lisItems.SelectedItem;
this.lisItems.SuspendLayout();
this.lisItems.DataSource = null;
items.Remove(item);
this.lisItems.DataSource = items;
this.lisItems.DisplayMember = "DisplayText";
this.lisItems.ValueMember = "ValueText";
this.lisItems.ResumeLayout();
}
}
NOTE: I just paste the relevant code!
Upon clicking the Remove button, I'm removing the selected item from the
collection and re-binding the collection. I can remove any element, BUT ONLY
THE LAST ONE GIVES ME THE ERROR.
Thanks in advance for your help Tag: GroupBox... Tag: 88024
Again Winform Datagrid: Individual row height and Vertical Scrollbar
Hi,
We are using Windows.Forms.DataGrid control in our application.
Let me explain what i have done so far so it will easy to understand the
problem:
We have used DataGridIconColumnStyle for one icon column and second is
DataGridTextBoxColumn for some other purpose
In second column i am showing Comboboxes when user clicks on it directly.
Now when user clicks on first column's icon, we are showing a big panel in
second column in the same row where we had Combobox previously.
On click on first column's icon image, big panel with some info shows in
second column's place. And at that time we are changing row height and it
changes the row height for that perticular row.
Up to this, it works fine.
Now when second column shows panel in one cell with height changed, a
vertical scroll bar appears.
But when i click on scrollbar to scroll downside, it scrolls whole first
column which has double height than total height of all other rows with
default height.
So problem is:
1. When i scroll down, it is not scrolling as per total height but it
scrolls up the whole first row in one stroke wich has very big height.
2. When it scrolls up the first row with big height value, it is not
scrolling up whole panel that i have put in the second column. It scrolls up
by just default row size.
So, what i want to do is:
1. Smooth scrolling of the vertical scroll bar
2. And with scrolling of datagrid rows, the panel should scroll also.
Before you write any comment, please have a look at the following lines,
1. I have searched all the relavant messages in the private and public
newsgroups but could not find the solution.
2. In most of the posts they have individual row height change problem which
we have done, so we have a problem of scrolling after changed height.
3. I have also searched many forums online and using google also. But i
could not find any solution so please do not point me out that look at
similar posts that has been posted previously.
I hope, i will get reasonable answer from you all experts as well as MSFT
engineers.
I hope to see some good pointers, idea, or trick to solve my problems.
You are most welcome for further clarification if you feel so.
Thanks in Advance.
Regards,
Mahesh Devjibhai Dhola Tag: GroupBox... Tag: 88023
download file while showing progress bar
Hi there
I'm attempting to download a file from our server programmatically using an
internet connection. Ordinarily I would use WebClient.DownloadFile() but I
would like to show a progress bar during the download.
The code is given below.
Any ideas why it fails?
Best regards
Loane
[Other info: "pbr" is a progress bar initiated earlier in the code]
Dim fs_App As FileStream = New FileStream("C:\mainapp.zip", FileMode.Create)
datBuffer = New Byte(1023) {}
Dim reqSync_App As WebRequest =
WebRequest.Create("http://www.123.com/mainapp.zip")
Dim respSync_App As WebResponse = reqSync_App.GetResponse()
Dim strm_App As Stream = respSync_App.GetResponseStream()
Dim len_App As Double
Dim total, cnt_App As Integer
While total < pbrSync.Maximum
cnt_App = strm_App.Read(datBuffer, 0, 1024)
If cnt_App <= 0 Then Exit While
fs_App.Write(datBuffer, 0, cnt_App)
total += cnt_App
If total < pbrSync.Maximum Then pbrSync.Value = total
lblInfo7b.Text = "Downloading application file ... (" &
(total/1024).ToString("#,##0") & "KB of " &
(pbrSync.Maximum/1024).ToString("#,##0") & "KB) (" &
((total/1024)/(pbrSync.Maximum/1024)*100).ToString("##0") & "%)"
Application.DoEvents()
End While
respSync_App.Close()
strm_App.Close()
fs_App.Close() Tag: GroupBox... Tag: 88019
Problem with form sizing
Hi
I got an VB.NET 2003 App with an MDI form and 4 child forms, designed for
780x1024.
This applications is distributed world wide, but 2 users complain that they
cannot see the full screen,
or even with the scrollbars they are not able to scroll to the hidden areas.
They use WINDOWS 2000 pro, Traditional Chinese
Others are using Windows 2000 Pro Chinese Simple, and have no problems
Forms borderstyle = Sizable
AutoScroll=true
Any hint where to look about at this issue is welcome.
Jens.. Tag: GroupBox... Tag: 88012
Custom Collection "Display Name"
I have a custom collection(which inherits from the collectionbase and
implements ibindinglist) with various properties like DateOfSale,
DateOfPayment etc... When I bind to a grid for example I want the header
to display Sale Date and Payment Date. Is there a way to handle that in
the custom collection?? Specifically is there an attribute that i can set??
--
Message posted via http://www.dotnetmonster.com Tag: GroupBox... Tag: 88009
Quest: Setting Dlg Forms' OK & Cancel Buttons Correctly...
I have two modal dlg forms that are invoked(seperately) by a main form but
the two modal dlg forms don't close when clicking the OK & Cancel buttons
setup as below...
Here the setup...
//In MainForm.cs...
//I Don't want the main form to close with enter and esc keys...
MainForm.AcceptButton = None; //Not in code...
MainForm.CancelButton = None; //Not in code...
//I use ExitApp button to exit app...
...
void ExitApp_Click(...)
{
Close();
}
//In My1stDlgForm.cs...
//I Do want the main form to close with enter and esc keys...
OKDlgButton.DialogResults = ....OK;
CancelDlgButton.DialogResults = ....Cancel;
...
My1stDlgForm.AcceptButton = OKDlgButton;
My1stDlgForm.CancelButton = CancelDlgButton;
//In My2ndDlgForm.cs...
//I Only want the form to close with enter keys...
OKDlgButton.DialogResults = ....OK;
...
My2ndDlgForm.AcceptButton = OKDlgButton;
My2ndDlgForm.CancelButton = ...None;
Note: End of codes above...
The program builds and runs but doesn't close. I have other C# programs that
the button worked and check the codes above with the old program an
everything matchs up...
Where else do I look to set this up...
Any help... Tag: GroupBox... Tag: 88008
One Click Deployment Constrain
Hi:
I can not find any smartclient news group in Microsoft news site, so post
question here.
We are using smart client one click deployment technology now, there are
some brief descriptions about constrains of using smart client in IE.
Is there any detail spec on what API can be used, or is there any testing
tools from Microsoft which can help to quickly identify potential issue in
oneclickdeployment.
Thanks
Sidney Tag: GroupBox... Tag: 88007
Controls disabled or Readonly
On my .NET 2003 form(s), I'm restricting changing of existing records by
setting the Enabled property to False on the bound controls. However, I
notice that the textbox and combobox is painted differently when disabled.
Plus, the grayed out text is hard to read. I've also tried using readonly,
but don't like that option either. I prefer the controls keep the enabled
look if possible.
Anyone have a technique for ensuring existing data is not changed and/or
allowing entry only when a new record is being entered, short of e.Handled
on the keypress event.
Thanks,
Michael Tag: GroupBox... Tag: 88004
Graphic bug - position of controls not consistent on another computer
Hello,
I've release a small tools in .NET and out of 4000 users, I have 2 of them
that experience the same issue and I would like to know if anyone ever seen
that before.
- The background is a big image
- I use standard control (text box, label, button, checkbox) over the
background
- Positions are very important so that they fit right with the background.
For some weird reason, 2 of my client have everything un-aligned.
[View a print screen of the difference]
http://www.gwfreaks.com/bug.jpg
The right version has been submitted to me. On that seen it's not that bad
but all the rest of the application (with dozen of control misaligned) is
pretty unusable.
What can cause this?
- Theme? (One of my clients is on windows 2000 other on windows XP)
- Style?
- Plugging that cause control to be different?
Is there any know solution or issue that could help me.
Thanks a lot.
--------------------------
Jean-Claude Morin, MCAD
Software Developer Tag: GroupBox... Tag: 88003
DataGrid VScrollBar Bug?
I have a DataGrid that ends up with a VScrollBar due to the number of
rows, and the behavior I want is for the bottom-most row of the
DataGrid to be shown, i.e., I want the VScrollBar all the way to the
bottom (maximum).
I grab and set the VScrollBar using the following:
if ( historyDataGrid.Controls[1] is VScrollBar )
{
VScrollBar vsb = (VScrollBar)historyDataGrid.Controls[1];
vsb.Value = vsb.Maximum;
}
This ALMOST works. The VScrollBar moves to the bottom, but the
DataGrid is scrolled only to about 99.5% of maximum. A mouse click to
the sliderbar or the small-increment button causes the DataGrid to be
scrolled all the way to the bottom. I have tried all sorts of stuff -
I'm almost ready to fake a mouse click, but that just seems waaayyyy
too ugly.
Any help greatly appreciated. Tag: GroupBox... Tag: 87996
DSO Framer - not firing Events in C# - SOLUTION!!!!!
The Microsoft Dso Framer control is a container that can house Office
documents. The control is really great. However I needed to trap the
events that it fired in C#. They worked fine in VB6, not in C# or
VB.NET.
The issue was the way the events were fired. The fix required only
minor changes to the code.
How do I get Microsoft to integrate these changes into the next version
of the framer control?
Thanks,
Victor Feintuch
DST International
HiRisk Risk Management Division
There are changes to 3 .cpp files
The main change is to utilities.cpp
The code to DsoDispatchInvoke was changed and all calls to it it were
changed:
Change to utilities.cpp
////////////////////////////////////////////////////////////////////////
// DsoDispatchInvoke
//
// Wrapper for IDispatch::Invoke calls to event sinks, or late bound
call
// to embedded object to get ambient property.
//
STDAPI DsoDispatchInvoke(LPDISPATCH pdisp, LPOLESTR pwszname, DISPID
dspid, WORD wflags, DWORD cargs, VARIANT* rgargs, VARIANT* pvtret)
{
HRESULT hr = S_FALSE;
DISPID dspidPut = DISPID_PROPERTYPUT;
DISPPARAMS dspparm = {NULL, NULL, 0, 0};
CHECK_NULL_RETURN(pdisp, E_POINTER);
dspparm.rgvarg = rgargs;
dspparm.cArgs = cargs;
if ((wflags & DISPATCH_PROPERTYPUT) || (wflags &
DISPATCH_PROPERTYPUTREF))
{
dspparm.rgdispidNamedArgs = &dspidPut;
dspparm.cNamedArgs = 1;
}
SEH_TRY
hr = pdisp->Invoke(dspid, IID_NULL, LOCALE_USER_DEFAULT,
(WORD)(DISPATCH_METHOD | wflags), &dspparm, pvtret, NULL, NULL);
if (!SUCCEEDED(hr)) {
if (pwszname)
hr = pdisp->GetIDsOfNames(IID_NULL, &pwszname, 1,
LOCALE_USER_DEFAULT, &dspid);
if (SUCCEEDED(hr))
hr = pdisp->Invoke(dspid, IID_NULL, LOCALE_USER_DEFAULT,
(WORD)(DISPATCH_METHOD | wflags), &dspparm, pvtret, NULL, NULL);
}
SEH_EXCEPT(hr)
return hr;
}
Changes to dsofauto.cpp
DsoDispatchInvoke(m_dispEvents, L"OnDocumentOpened",
DSOF_DISPID_DOCOPEN, 0, 2, rgargs, NULL);
DsoDispatchInvoke(m_dispEvents, L"BeforeDocumentSaved",
DSOF_DISPID_DOCOPEN, 0, 2, rgargs, NULL);
DsoDispatchInvoke(m_dispEvents, L"OnDocumentOpened",
DSOF_DISPID_BDOCSAVE, 0, 3, rgargs, NULL);
DsoDispatchInvoke(m_dispEvents, L"BeforeDocumentClosed",
DSOF_DISPID_BDOCCLOSE, 0, 2, rgargs, NULL);
DsoDispatchInvoke(m_dispEvents, L"OnDocumentClosed",
DSOF_DISPID_DOCCLOSE, 0, 0, NULL, NULL);
Changes to dsofcontrol.cpp
DsoDispatchInvoke(m_dispEvents, L"OnPrintPreviewExit",
DSOF_DISPID_ENDPREVIEW, 0, 0, NULL, NULL);
hr = DsoDispatchInvoke(m_dispEvents, L"OnFileCommand",
DSOF_DISPID_FILECMD, 0, 2, rgargs, NULL);
DsoDispatchInvoke(m_dispEvents, L"OnActivationChange",
DSOF_DISPID_ACTIVATE, 0, 1, rgargs, NULL); Tag: GroupBox... Tag: 87995
Form WITH Minimize, but NOT close?
Can anyone suggest how I might achieve having a Minimize button, but NOT a
maximize or close button on a form?
Thanks!
-mdb Tag: GroupBox... Tag: 87993
Finding the MDI Parents Workspace Size
Hello,
I have an MDI Parent, then I have an MDI Child window. The MDI Parent has
a Main Menu and Toolbar control on the top. Right now I want the MDIChild
window's Window State to be set to Normal, however I want to manually resize
the window to fill up as much of the space on the MDIParent's workspace as
possible without being maximized.
I can get the size of the MDI parent's workspace but that doesn't include
the space taken up by the Main Menu and Toolbar. Is there any property or
way to get the MDI Parent's height and width of the workspace?
Thanks. Tag: GroupBox... Tag: 87990
Changing the colors of a ToolStripMenuItem in VS2005 Beta 2
I'm trying to programmatically change the foreground and background
colors of a single ToolStripMenuItem on a ContextMenuStrip in VS2005
Beta 2.
menuMapper.BackColor = Color.Green;
menuMapper.ForeColor = Color.Purple;
The background color doesn't change and the foreground color only
changes when I hover over it. What am I doing wrong?
Thanks
Dave Tag: GroupBox... Tag: 87987
Datagrid - setting column sort programmatically
I have bound a datagrid to a table in a dataset.
Clicking a column to sort the presented grid rows works great. I have
managed the indexing issues fine.
I need to be able to preserve this sort order when necessary to refresh
my dataset programmatically (dataset is manually created), or between
program runs. This means I need to be able to both get and set the
current datagrid sort setting. I have browsed the objects in the
debugger, but can not find it. Tag: GroupBox... Tag: 87985
ImageList in Toolbar
Hi,
How can I use a bitmap strip (16x16 images) in an ImageList which can then
associated with a toolbar control? Tag: GroupBox... Tag: 87983
Delete Key in DataGrid
Hello All,
I Need to disable delete key so it should not delete rows from the datagrid
but should be able to use the delete key when editing the cell. If any one
has any suggestions please let me know.
Thanks
Raj Tag: GroupBox... Tag: 87982
tool tips apearing behind a form!
I've got MyControl inheriting from TreeView that sits on MyOtherControl
which inherits from Control.
setting m_tooltip.SetToolTip( MyControlInstance, "hello" ); within the
mouse move of MyControl causes the tool tip (when it's long enough to
see) to appear however I get another tool tip (from the underlying Win32
TreeView control) _behind_ the dialog box that it all sits on.
Any ideas why? I looked at intercepting WM_NOTIFY and NM_TOOLTIPSCREATED
but I don't seem to get the message. I thought I could supress it.
adam Tag: GroupBox... Tag: 87978
Determine if the mouse is outside the form
I need to detect if the mouse get out of the window form.
I'm displaying a form with border and titlebar with a panel that
covers all the surface of the form, so unfortunately the MouseLeave
event is of no use.
Probably it should get the form rectangle and see if the mousepointer
is contained inside.
How can I do that? (I'm working in C#)
Thanks. Tag: GroupBox... Tag: 87969
Can I enumerate a BindingContext?
Hi:
Is it possible to enumerate a BindingContext, returning all its
BindingManagerBase objects so I can recover all the DataBindings from the
returned object?
All I can see is the indexer (BindindContext[DataSource]) where I need to
pass a DataSource to recover the BindingManagerBase object, but I don't have
the DataSource, this is why I need to enumerate all of them.
TIA,
MartinH. Tag: GroupBox... Tag: 87965
How to prevent a form from closing - 2 part question
Hi,
I am trying to prevent a form from being closed by the user until the code
in the OnLoad method executes. This code can take quite some time to
complete executing. This form itself is launched from my main form using
ShowDialog.
I cannot use an approach like having another form showing 'Please Wait' or
something to that effect.
The basic problem here is that I need to run some code on the Close event of
the form, which does not get executed if the user closes the form as I
described.
I guess another way of asking my question is whether there is any way the
code in the Close event will ALWAYS get executed - some other event etc? Tag: GroupBox... Tag: 87964
ToolStripTextBox - Can't trap Enter keypress?
I have a ToolStripTextBox in a WinForms app and I'm trying to trap hitting
the Enter key. I tried doing it a bunch of different ways that should work
for a regular textbox KeyDown event, KeyPress event, etc.
What's interesting is that while the events get fired for other keypresses
in the ToolStripTextBox, hitting Enter doesn't seem to! Is this a bug? How to
overcome this problem??? Tag: GroupBox... Tag: 87957
Keypress combo vs text on win2k
I have a C# application where i've set .keypress of both a textbox and
combobox to the same keypress handler. All it does it checks to see if enter
is pressed, and if no it sends a tab key.
On windows XP Home/Pro this works fine. But on windows 2000 they keypress
event handler is never being called when i a text box, but it when in a combo
box.
Here's the function:
private void Handle_Keypress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar == (char)13)
{
SendKeys.Send("{TAB}");
e.Handled = true;
}
}
and the controls look like:
cbID.KeyPress += new KeyPressEventHandler(Handle_Keypress);
txID.KeyPress += new KeyPressEventHandler(Handle_Keypress);
This is compiled using VS.NET 2k3 with framework 1.1 and the hotfix is
applied to all machines.
The reason to do this is it was originally done on the KeyUp event but every
time they pressed enter it would beep. The reason was windows default
keypress event was being called and made that noise. My problem with it in
the keyup event is if a control fires a message box and you press enter, the
control ends up with the keyup even after pressing enter to get rid of the
message box, which causes the messagebox to appear again. Tag: GroupBox... Tag: 87952
XP standards for windows forms development
I am trying to build a Windows forms application based on XP styles. Could
someone let me know what are the common standards for building application
on XP styles/themes. I remember there was a documentation on the msdn
website but cant find it now.
Any help would be appreciated.
Thanks. Tag: GroupBox... Tag: 87948
Why not simple; how to change listbox selected item text
I've added items to a listbox by calling ListBox.Items.Add(new MyObject()),
where MyObject has overridden ToString to show each item's display value.
I can't seem to change the DISPLAYED TEXT when I change the object behind
the selected index:
((MyObject)listbox.SelectedItem).mydisplayproperty = "abcdef";
The ListBox display doesn't change, but I know the object is changed since
other buttons that examine the contents of each listbox item see it changed
(and enable/disable their button state). How can I easily do this? I've
tried Refresh, Invalidate, Update methods on the listbox. No luck.
Amil Tag: GroupBox... Tag: 87947
DataGrid: How do I prefill a row when it is added?
When using the DataGrid, I need to detect when a new row is being
added and then put initiali values in some of the columns.
I have managed to detect the new row being added by adding a handler
to the ListChanged event of the DefaultView of my DataSet.
What do I do now!!!
Thanks for any help!!
RichardF Tag: GroupBox... Tag: 87945
Using windows forms hosted in IE to connect to host
Hi,
I am trying to make my application of windows forms (hosted in IE by using
UserControl) to connect to a port on the machine the "applet" is downloaded
from. It would be useful if I could do this without changing the local
security settings and it would also be nice to have a way of acquiring the
server's IP address in an easy manner. Does anyone know how?
Thanks,
Magnus Gran-Jansen Tag: GroupBox... Tag: 87942
MessageBox is not working when VS beta 1 installed
I getting EMPTY message boxes, when running this code
System.Windows.Forms.MessageBox.Show("AAA");
under VS 2003
I also have VS 2005 beta 1 installed on my machine.
What should I do??? Tag: GroupBox... Tag: 87937
hi:
is there a way to trigger a contextMenu when right-clicking on the
groupBox text title?
thanks...