How to determine single click vs. double click?
I have a windows forms application that needs to do one thing for a single click and another thing for a double click event.
However, the forms click event gets fired whenever a double click event occurs and I don't want to perform the single click event
plus the double click whenever the user double clicks on the form. What is the best (standard) way to handle this?
IMHO it seems like there should be three Click events for a form:
Click - Gets fired on first mouse down mouse up
MouseDown
Click
MouseUp
SingleClick - Gets fired after click if no double click
MouseDown
Click
MouseUp
SingleClick
DoubleClick - Gets fired after second mouse down mouse up
MouseDown
Click
MouseUp
MouseDown
DoubleClick
MouseUp
Am I missing something?
Thanks.
Gregg Walker Tag: Cut, Copy, & Paste Menu Tag: 66344
Setting the length of datagrid columns
I am binding a datatable to a datagrid in VB.NET I then want to change
the width of the first column. I am unable to get the right syntax.
Here is the code I tried
Dim mydataset As DataSet
gclodatabase.GetDataSetJobs("Select * from qryJobs",
mydataset)
Dim Mydatatable As DataTable = mydataset.Tables(0)
dtgSelect.DataSource = mydataset.Tables(0)
dtgSelect.TableStyles(0).GridColumnStyles("JobId").Width = 10
? this fails with an error An unhandled exception of type
'System.NullReferenceException' occurred in Proposals.exe
?Additional information: Object reference not set to an instance of an
?object.
dtgSelect.TableStyles(0).GridColumnStyles(1).Width = 10
? this fails with error
?An unhandled exception of type 'System.ArgumentOutOfRangeException'
?occurred in mscorlib.dll
?Additional information: Index was out of range. Must be non-negative
?and less than the size of the collection.
dtgSelect.Refresh() Tag: Cut, Copy, & Paste Menu Tag: 66342
How to add new line to TextBox
How do i add a new line to the TextBox (Multiline=true)
With out making a copy of the whole array.
Thanks.
George. Tag: Cut, Copy, & Paste Menu Tag: 66340
Toolbar dropdown button problem
My vb.net form was using a toolbar control with no problems. I needed to
modify the toolbar to add a dropdown button showing a menu. After that, the
images of my toolbar won't appear at runtime, though they appear at design
time. I am not using XP styles and also tried to edit the automatic
generated code to make the imagelist control to be the first to load. The
problem remains. Can anyone help me with this problem?
Thank you.
Julian Tag: Cut, Copy, & Paste Menu Tag: 66337
Gui-framework
Which gui Frameworks do exist for .net c#?
Myself just found
SharpLibrary Version 1.37
http://24.199.8.122/
Maybe people who know other frameworks could reply ?
thx
Dulo Tag: Cut, Copy, & Paste Menu Tag: 66335
Question about DataTable and DataGrid
Hi,
- I have created a table that has 4 columns (type System.String) - called myDataTable. The table is created during the Form_Load function.
- I have created a DataGrid, called dataGrid1.
Now, to my problem:
Each time my user clicks on the "search" button, a search is performed, the table is cleared with myDataTable.clear() and filled with the new data. Then I want to bind the DataGrid to the table, using dataGrid1.DataSource = myDataTable -- which contains the new results each time. But - I am getting an exception. Since I have tried to debug this, I am almost positive that the problem is related to the binding. Can someone offer help? or shed some light on how to bind the Grid to a table?
Actually I would love to know if there is a way to fill the DataGrid control without messing around with tables or datasets...
BTW - I am using C#
Thanks Tag: Cut, Copy, & Paste Menu Tag: 66329
Textbox.OnValidating event does not trigger
Hello,
Here is the problem,
My code exits out of the TextBox.OnValidating event
cleanly because the user has clicked on a menu that allows
the user to load another screen, when that screen is
unloaded and the cursor is back on the TextBox, I am
able to tab off the textbox without it running my
OnValidating event again, how do I get .Net to force the
validating event to be triggered as soon as I tab off in
ALL cases.
Please note the CauseValidated property is set to the
default value of true so I know that it should be
triggering in all cases but it does not in this case.
Please help, Tag: Cut, Copy, & Paste Menu Tag: 66326
Can I create another form in another thread?
hi, everybody
I want to create another form in another thread. But if I do this, the form will be created and closed immediately
Can I create another form in another thread
The purpose I want to do is that before the application is started, I want to display a starting form. So I create
the starting form in another thread in the form() handler. Or can I use another method to achieve this
thanks Tag: Cut, Copy, & Paste Menu Tag: 66325
IIS ports
I have a winform control that works when called from a html page when IIS is
running on port 80 but if i change the port(which i need to do) then it
never is displayed ?
anyone seen this ? do i have to alter any .net config files or anything ??? Tag: Cut, Copy, & Paste Menu Tag: 66324
Update current row in Datagrid
Hello!
When running dataadapter.update current row in my datagrid is not updated.
I want the current row to be updated without having to move to another row
in my datagrid.
Any ideas?
Regards Magnus Tag: Cut, Copy, & Paste Menu Tag: 66318
PeekMessage(), GetMessage()
Hello All
Is there an alternative of Win32 API's PeekMessage() and GetMessage() functions in .NET
What I want is to peek in the message queue for a message and if it is some specific message, I need to discard it from being dispatched to the form
Can this be achieved in .NET? I couldn't find any method in System.Windows.Forms.Form class
Thanx in Advance
Mahesh. Tag: Cut, Copy, & Paste Menu Tag: 66317
Set source of Datagrid with query
Hi
Does anyone know how to set the source of a dtatagrid by means of a query and that the datagrid only shows the columns from the query. I have some code like this
Me.OleDbSelectCommand1.CommandText = "SELECT X, Y " &
"FROM TABLE " &
"WHERE TABLE.[X] = 2
Me.OleDbSelectCommand1.Connection = Me.OleDbConnection
Me.Dataset1.Clear(
Me.OleDbDataAdapter1.Fill(Dataset1
Me.DataGrid1.SetDataBinding(Dataset, "TABLE"
Now the problem is that the datagrid shows all columns of TABLE instead of just the columns X and Y. I'm getting the columns of the complete table. Is it possible to show only the columns X,Y
Thanx.... Tag: Cut, Copy, & Paste Menu Tag: 66314
Tooltips on a PropertyValueUIItem
I've successfully enabled PropertyValueUIItem use on a PropertyGrid by
making a Container that implements IPropertyValueUIService, and then
adding the PropertyGrid to it.
As a result, you get nice tiny icons that sit on the property name,
and you can double-click on them to invoke a handler.
However, the MSDN documentation seems to think you can also associate
a tooltip with the PropertyValueUIItem. I've done so, but no tooltip
comes up. I've plowed through ILDASM on several .NET DLL's and don't
see any fetching of the ToolTip property -- so question is: is this
actually implemented?
And if not, is there a suitable workaround? (Say like 10 lines of code
that will automagically re-enable tooltips in property grids...)
Cheers,
Glen Low, Pixelglow Software
www.pixelglow.com Tag: Cut, Copy, & Paste Menu Tag: 66313
Use ComboBox to create a function which like the "find in files" of VS .Net
hi, everybody
I want to use ComboBox to create a function which like the "find in files" of VS .Net. The problem I meet is that when the user select a item of the ComboBox
the selected item will become the first item. I want to do this in the SelectedIndexChanged handler. But when the selected item is moved to the first item
the SelectedIndexChanged event will be fired. And it will become recursive fired. Is there any method to avoid this? Or is there other event I can fire in
thanks Tag: Cut, Copy, & Paste Menu Tag: 66310
DataGrid's CurrentRowIndex doesn't show new row's index.
I've got a strongly typed dataset with three tables. Call them parent,
child, and grandchild. There are relationships between parent and child,
and between child and grandchild, using fields parentId and childId
respectively. parentId and childId are autoincrement, with seed = 0 and
step = -1.
On a form I've got a DataGrid (with the most important fields) and some
textboxes (with more details) at each level. That is:
dgParent.DataSource = ds
dgParent.DataMember = Parent
dgChild.DataSource = ds
dgChild.DataMember = Parent.Parent_Child
dgGrandchild.DataSource = ds
dgGrandchild.DataMember = Parent.Parent_Child.Child_Grandchild
txtParentDetail.DataBindings.Add(New Binding("Text", ds, _
"Parent.ParentDetail"))
txtChildDetail.DataBindings.Add(New Binding("Text", ds, _
"Parent.Parent_Child.ChildDetail"))
txtGrandchildDetail.DataBindings.Add(New Binding("Text", ds, _
"Parent.Parent_Child.Child_Grandchild.GrandchildDetail"))
Viewing data from the database, everything is cool. I can change existing
data and update it fine. I can create new grandchildren. The problem
arises when I click in the last (empty) row of the Child DataGrid, wanting
to create a new Child of the current parent. I enter some data, tab to the
next field, and the data I entered vanishes.
Furthermore, the Child-level textboxes continue to display the data of the
last Child record I was looking at (before I clicked into the last row of
the Child DataSet). I expected them become blank, showing that data has not
yet been entered for the new Child row.
Thinking perhaps the Child DataGrid and Child textboxes had somehow got
different CurrencyManagers. I took a look at this:
BindingContext(dgChild.DataSource, dgChild.DataMember) Is _
txtChildDetail.DataBindings("Text").BindingManagerBase.
But it was true, which I think is as it should be.
Then I put some code into the dgChild's CurrentCellChanged event, to display
the DataGrid's current row and the CurrencyManager's position in the status
bar.
MyStatBarPanel.Text = "DG: " & dgTktGrp.CurrentRowIndex.ToString & _
" CM: " & BindingContext(dgTktGrp.DataSource, _
dgTktGrp.DataMember).Position.ToString
What I found here was that the DataGrid's CurrentRowIndex and the
CurrencyManager's Position were always the same as each other, which is
good. BUT, neither of them changed when I clicked into the last (empty) row
of the DataGrid. Which doesn't seem right, does it?
If anyone can explain either (a) what I might be doing wrong to cause this
oddness or (b) why this behavior is perfectly natural and what is the proper
way to add new records at the Child level, I will be very grateful.
Thomas Berg Tag: Cut, Copy, & Paste Menu Tag: 66309
Error '33' in the paint routine...
This is one of those weird errors that probably nobody knows of, but I will try anyway, maybe somebody knows...
I designed a datepicker as a drop-down control. When the control drops the floating form calendar is displayed. One can press the year and a numeric up-down appears where you can change the year. All controls are inherited and I override the WndProc and handle all mouse message so that no one of the controls gets focus, in this way the main form never looses focus when the control is dropped-down. All is fine except for the following situation: when the application starts the control is not focused. The control is then either clicked or tabbed to. If you click the year the numeric up down appears. Here is what happens: one of the buttons of the numeric up down generates an error in the WndProc on the WM_PAINT message. The error is the windows error #33: ERROR_LOCK_VIOLATION. What is extremely weird is: both buttons (up and down) are of the same exact type and they both created and dealt with in the same manner. Still only one has this strange behavior. Also, if one presses the tab key a few times and the focus goes away from the control and then returns to it... no error occurs... What can be the problem??
The floating form is a form with a custom control on it who owns the numeric up-down. The form is shown using the SetWindowPos api...
If anybody has any idea, or suggestions?
thank you,
iulian Tag: Cut, Copy, & Paste Menu Tag: 66308
How to sort DataGrid using code?
I guess I could change the SELECT statement to ORDER BY, but that won't show
the little sort arrow on the DataGrid's column header.
What is the code to sort a Windows' DataGrid column? Simulate a user
clicking on a particular column header.
In my case, I want to sort by "Last Name" by default.
Thanks in advance. Tag: Cut, Copy, & Paste Menu Tag: 66306
Version resource for C#
Hi,
Is there a way to add a traditional C++ style version resource to a C#
Windows forms-based application? The version resource is what gets
displayed on the Version tab when you bring up the property sheet for the
.exe or .dll file in Windows Explorer.
In the documentation I see a version resource editor for C++, but it looks
like resources for C# and managed C++ are done differently. I do not need
to read this resource from inside the code, it is just that this is our
first .NET-based product and we have an internal standard that all released
products need to have correct version information in all modules. This is
so tech support can have the customer bring up property sheets in Explorer
to figure out exactly which versions of everything the customer is running.
Thanks for your help.
-Vance Gloster Tag: Cut, Copy, & Paste Menu Tag: 66305
How to make all buttons in toolbar the same size?
Hi,
I'm having some trouble making all the buttons in the toolbar the same size.
My toolbar property TextAlign is set to "Underneath" and all the icons in my
ImageList have a width of 48 but the actual buttons' size varies from 48 to
around 60 depending on the corresponding text.
What I would like is to have all buttons in my toolbar have a width of 64. I
tryed changing the ButtonSize property but it didn't help.
Thanks in advance for any help.
Luis Tag: Cut, Copy, & Paste Menu Tag: 66302
InitializeComponent question
Hi.
What is the exact purpose of <System.Diagnostics.DebuggerStepThrough()>
in the InitializeComponent routine? If I delete this attribute the form
continues to run without problems and I can step into it.
Regards,
Chris Leffer
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! Tag: Cut, Copy, & Paste Menu Tag: 66299
Hosting winform Controls question.
Hey all,
I have created a tiny web page to host my winformcontrol. When running this
by default on IIS port 80 it works fine however I want to run IIS on port 90
and it doesnt seem to work correctly.
I changed the IIS port the webserver listens to, and also changed the html
so the port is included in the CLASSID part of the object tag but my browser
does not render the control correctly.
It seems to be able to locate the control as I dont get the usual little
graphic in the top left corner which indicates broken link but an empty box
with a disabled scrollbar.
Anybody seen this before ?
Is there some other confiuration change i have to make ? Tag: Cut, Copy, & Paste Menu Tag: 66298
Controls not refreshed using object databinding
Hi
I have a simple object Person with two properties ForeName, SurName
The object is initialised in the form constructor and its properties are bound to two text box controls. This works fine. However if I change one of the object properties the text box controls arenâ??t updated with the new values
Many thank
Exmaple
private Person _currentPerson
public frmEmployees(
// Required by VS.NE
InitializeComponent()
// Init _currentPerson objec
_currentPerson = new Person()
_currentPerson.ForeName = "Fred"
_currentPerson.SurName = "Flintstone"
private void frmEmployees_Load(object sender, System.EventArgs e
// Databind form to current person objec
txtForeName.DataBindings.Add("Text", _currentPerson, "ForeName")
txtSurName.DataBindings.Add("Text", _currentPerson, "SurName")
private void butChangeName_Click(object sender, System.EventArgs e
_currentPerson.ForeName = "Pink"
_currentPerson.SurName = "Panther"
} Tag: Cut, Copy, & Paste Menu Tag: 66293
List tables and columns in designer
I have a control that I am working on that interacts with a DataSet to
display data.
I want to be able to use the designer with this control in the same way as
with the DataGrid control, where once a DataSet is associated with the
control, I can then select tables and columns from the DataSet for
displaying (assuming of course that the DataSet is stingly typed).
Can anybody provide any pointers? So far I have only managed to associate
the DataSet in the designer (well, that bits not exactly difficult is it!).
Thanks. Tag: Cut, Copy, & Paste Menu Tag: 66292
Shuting Down XP from within a Windows Form Application
Hi
I'm fairly new to the .NET programming environment. I am writting an Windows Form application that needs to shutdown the PC that is running the application. What is the proper way to do this
Please refer me to documentation that can explain how .NET applications can control the PC on which they are running
One of the things I would like to do is limit the access to XP features, for example, not allowing the user to access Control Panel, once my application is started.
Thanks in advance
- Neil Shor Tag: Cut, Copy, & Paste Menu Tag: 66291
equivalent ImageList exists function ??
Hi,
Can anyone tell how to see if an image exists in an imagelist by a name ?
rgds
d. Tag: Cut, Copy, & Paste Menu Tag: 66288
ANN: MathML .NET Control 2.0 (the equation editor control for .NET) released
soft4science is proud to announce the immediate availability of
MathML .NET Control 2.0. It is the first commercial equation editor
control for the .NET Framework.
MathML .NET Control 2.0 is a general-purpose equation editor specially
designed for the .NET Framework. Once added to Visual Studio .NET's
Toolbox, it can be dragged onto your Windows forms.
Every formula you create can be saved as MathML (the XML standard for
expressing math), a JPEG image or exported as a GIF image.
Written in 100% managed C# code, the control offers .NET developers a
fast and simple way to include a MathML based equation editor in their
Windows applications.
New Features in Version 2.0:
- Multiline Equation Editing
- Extended API (~30 new API methods)
- Default Toolbar can be replaced by user defined Toolbar
- Default Context Menu can be replaced by user defined Context Menu
- Default Keyboard shortcuts can be
deactivated and replaced by user defined shortcuts
To learn more, visit our website at:
http://www.soft4science.com Tag: Cut, Copy, & Paste Menu Tag: 66287
BeginInit() and EndInit() in Generated Code Region
When I create a form using the DataForm Wizard (VS 2003), the following
lines of code get generated near the top of the
Windows Form Designer generated code region:
CType(Me.objdsDataForm,
System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdtitles,
System.ComponentModel.ISupportInitialize).BeginInit()
The corresponding EndInit() statements get generated near the bottom of the
region:
CType(Me.objdsDataForm,
System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdtitles, System.ComponentModel.ISupportInitialize).EndInit()
Can someone explain to me what these statements do? Also, since the DataSet
and DataGrid objects both implement the ISupportInitialize interface, why do
those objects need to be converted to the interface type before the
BeginInit and EndInit methods are called? Why not just call those methods
directly on the DataSet and DataGrid objects?
Thanks.
--
Greg Dunn Tag: Cut, Copy, & Paste Menu Tag: 66278
Division Confusion
Hi all,
I'm having trouble understanding which data type to use to get results I
expect.
using float, decimal, and double I have tried the following, ..
float test = 55/60;
I always get 0 as the results.
I expect 0.916666
I dont understand why its rounding down. Any pointers anybody ?
Rgds,
Dave Tag: Cut, Copy, & Paste Menu Tag: 66269
Owner draw status bar text
Hi.
How cai I center text on a owner draw status bar using vb.net? One of
the panels of my status bar needs to be red and have some centered
text in it. I discovered how to make it red, but didn't find a way to
center text on the panel.
Thanks,
Robert Scheer Tag: Cut, Copy, & Paste Menu Tag: 66268
Windows Forms stops responding after debugging
I am experiencing a very odd problem. When I stop my application at a break
point or with an Assert, after I continue running my form stops responding.
Is this a known problem or does any one have any suggustions as to what may
be happing or how to "debug" it.
Background:
We have developed a client application that is built on multiple layers of
UserControls. There are dozens of usercontrols made up of standard window
Forms controls and a few inherited windows Forms controls.
When ever I stop the application at a break point or with an Assert
everything behaves as expected. I can step through the code, look at
fields/properties etc. But when I continue the application, the webForm
displays, can be minimized, maximized, but cannot be closed. Individual
controls "react" to mouse movement, (for example a Treeview with hot
tracking will "track" mouse over a treenode) but I cannot select a node in
the tree view or List View. Menu don't open (main or context), buttons
don't respond to being clicked.
I will continue to try an isolate what "recent" changed were made to
determine what could be causing this, since it didn't behave like this
before, but I was hopeing this behavior has been seen before and there is a
know course of action to resolve it or at least identify what could be
causing it.
Any assistance would be apreciated.
Ben R. Bolton Tag: Cut, Copy, & Paste Menu Tag: 66267
Potential problem when closing application - help!
Hello,
I have a windows forms application that I am creating. When I compile in
debug mode, and run the application, it all functions fine; but when I exit
the application (either via the x at the top of the form window, or via my
own function) it appears that something in the application keeps running, as
I have to manually press the stop debugging menu option before control of
the application actually stops..
Does this mean that something is not cleaning up properly in the
application? And if so, how do I figure out what is causing the issue?
Could this just have something to do with debug mode?
Any help on this would be appreciated!
Thanks!
Jim
ps -> I am using VB.NET 2003, and the Net Framework V1.1 Tag: Cut, Copy, & Paste Menu Tag: 66263
Avoiding the "File download" dialog when using the WebBrowser control to navigate to an excel file (C#/Windows Forms)
Hi,
My Windows Forms application uses the WebBrowser control to
open an Excel file since OLE objects are gone in .Net. The application
is actualy a clone of the one found in the MS Knowledge Base Article
"How to Use the WebBrowser Control to Open Office Documents with
Visual C# .NET" which can be found here:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;304662
The application does what it's supposed to (ie Loads embeded Excel
and opens the file), the problem is that prior to that it displays a
"File Download" dialog. For personal use i could simply uncheck the
"always ask before opening this type of file" checkbox but for the
the release this is not an option.
I would like to know if it is possible to avoid the "File Download"
dialog.
Thanks in advance for any help.
Luis Ferrao Tag: Cut, Copy, & Paste Menu Tag: 66262
Normal Size Font versus Large Font
We have a large development team working on the same application. Some
developers, because of their development hardware (which may be either a
desktop or laptop, etc.) use Normal Size Font, while others prefer to use
the Large Font setting.
A problem arises because when you open up a form in the IDE, the values for
size will change slightly depending upon whether Normal Size or Large Size
Font is being used. This causes the size of fields and the position of
fields to move around depending upon who last "touched" the form (i.e. what
Font setting they were using).
Nor is the change in size consistent. When Normal Size Font is used, we may
size each field on the form to be 24 units tall. When it is opened on a PC
that runs Large Font, these same fields may be 30, 31, or 32 units tall! The
size is not only different, but fields that were consistently all sized to
be 24 units tall on a Normal Size Fonts system may be any of a variety of
sizes when the form is opened on a development machine that runs Large
Fonts.
This causes serious problems because our QA team is quick to point out forms
that are laid out in a sloppy fashion! This "sloppy" appearance is simply a
result of this Large Size/Normal Size Font problem in the VS.IDE. And our
software testing automation tools go wild when the forms change this way!
Even buttons change size slightly!
We will probably have to legislate (rather arbitrarily) that everyone on the
development team use Normal Size Fonts which will cause problems on some
hardware platforms.
Has anyone else noticed this problem? Is there a solution? We have easily
reproduced this by simply changing one station from Normal to Large fonts,
rebooting, and reopening the project. Argh!
Thanks, -Ron Tag: Cut, Copy, & Paste Menu Tag: 66259
ISynchronizeInvoke.BeginInvoke and polymorphic parameters
I have a problem when using ISynchronizeInvoke.BeginInvoke with polymorphic
parameters. It seems that if I try to call BeginInvoke and in the array of
parameters place an object that's derived from a base class my method
expects as a parameter, the method gets only an object of the type of the
base class, rather than my full object.
I know this sounds convoluted, so here's an example. My program consists of
an engine and a WindowsForms UI. The engine operates on a separate thread
and reports back to the UI using the main form's ISynchronizeInvoke
interface. When engine performs some operation during which it throws an
exception it calls OnProcessingStageException which in turn fires and event
that will be received by the UI. Here's how it looks.
public event EventHandler ProcessingStageException;
void FireEvent(EventHandler handler, Object sender, EventArgs e) {
if (this.target != null && handler != null) {
this.target.BeginInvoke(handler, new object[] {sender, e});
}
}
private void OnProcessingStageException(object sender, EventArgs e) {
FireEvent(ProcessingStageException, this, (ExceptionEventArgs)e);
}
The main form's method for handling this event is defined as follows:
private void OnProcessingStageException(object sender, EventArgs e) {
MessageBox.Show(
this, string.Format("Error performing operation.\nDetails: {0}",
((ExceptionEventArgs)e).ex), "VideoInspector");
}
The problem is that when I try to cast ((ExceptionEventArgs)e) I get
InvalidCast exception, even though ExceptionEventArgs inherits from
EventArgs.
Is this by desing or did I hit some kind of a bug?
Thanks for your help
Andrew Tag: Cut, Copy, & Paste Menu Tag: 66258
ListView's AllowColumnReorder property BUG
When we set AllowColumnReorder to true and drag column headers to reorder columns, the ListView.Columns collection remains unchanged (i.e. the indexes of the column headers do not change)
Is this a bug or am I something missing? Tag: Cut, Copy, & Paste Menu Tag: 66252
MDI - how to open a child from a child within MDI parent?
my problem is i have 3 form
mdi form: mdiParent
child form 1: frmProjects
child form 2: frmProjec
when my project start, it load a mdiParent form.
from the mdiParent's menus, i open the frmProjects (mdiParent's child form).
The problem is when i click a OK button on frmProjects, i failed to open the
frmProject which supposed to be a mdiParent's child form (frmProject opened
as an independent form which is not a mdiParent's child form).
How to call a mdi child form from another mdi child form? Tag: Cut, Copy, & Paste Menu Tag: 66241
MDI - how to open a child from a child within MDI parent form?
Hi,
I am trying to open a child from another child within MDI. I need to keep
everything within one parent form.
I wrote the following for each of the menu buttons on MDI parent:
Public Sub ShowMdiChildWindow(ByVal frm As Form)
If frm Is Nothing Then
Me.Show()
Else
frm.MdiParent = Me
frm.Show()
End If
End Sub Tag: Cut, Copy, & Paste Menu Tag: 66240
How to make MainMenu accelerator underline appear?
Everyone is familiar with the appearance of an underline below the accelerator character on a MainMenu when the user presses the ALT key. I would like the accelerator character underline to always be shown in my MDI application
Is there a way to control this programmatically
Thanks
Dav Tag: Cut, Copy, & Paste Menu Tag: 66239
Out of Memory
H
I have three functions, each one uses a connection to get information, I close that connections when the functions finish. I call the function every 10 seconds. But I sometimes get an exception
ERROR [S1001] [INTERSOLV][ODBC ]Out Of Memor
ERROR [IM005] [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_DBC faile
How to avoid this exception
Regard
J.C. Tag: Cut, Copy, & Paste Menu Tag: 66236
What event is fired when DataGrid row changes?
Is there an event that fires when the CurrentRowIndex of a Windows Form
DataGrid is changed? Thanks. Tag: Cut, Copy, & Paste Menu Tag: 66233
Disable/enable controls
On a form, when I want to disable a textbox, but leave the text readable, I set the ReadOnly flag to true. Works great.
However, I don't have this option with combo-boxes. When a combo-box has Enabled = False, the text becomes unreadable. Is there a way to override the complete 'grey-out' effect by changing Forecolor/backcolor/font?
--Billgs Tag: Cut, Copy, & Paste Menu Tag: 66231
Modifying Word templates
My company has a database (Oracle) of clients that contains there names and
addresses. I've been asked to look at making those names and addresses
easily available in Word. My thought (at the moment) is to import them into
a Word template as autotext entries and then distribute that template around
the company either overnight or at login. i.e. read people's Word startup
folder and drop a copy of the created template in there
I've come up with the following code (with the Word library referenced) that
will allow me to create the template....
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oTemp As Word.Template
Cursor.Current = Cursors.WaitCursor
oWord = CreateObject("Word.Application")
oWord.Visible = False
'Dummy template just containing a bookmark called bmark
oDoc = oWord.Documents.Add("c:\norm.dot")
oTemp = oWord.ActiveDocument.AttachedTemplate
Dim oRange As Word.Range
oRange = oDoc.Bookmarks.Item("bmark").Range
'Code here to loop through clients and do things like check for duplicate
names
oTemp.AutoTextEntries.Add("ddddd", oRange)
oTemp.AutoTextEntries.Item("ddddd").Value = "Just testing" + vbCrLf + "Line
two"
oRange = Nothing
oTemp = Nothing
CType(oDoc, Word._Document).Close()
oDoc = Nothing
CType(oWord, Word._Application).Quit()
oWord = Nothing
Cursor.Current = Cursors.Default
That seems to work but....
It needs to be run on a machine that has Word installed while, ideally, I
want it to run on a server. Anyone have a way around that?
Anyone have any better ideas on getting the same result?
--
For real reply address, replace the _surprised_ bits with dots Tag: Cut, Copy, & Paste Menu Tag: 66230
NullReferenceException in datagrid while scrolling
I have a problem with DataGrid, while filling a DataSet that is bound to it,
which throws a NullReferenceException, and the stack trace points to some
tooltip related functions in the datagrid.
This happens only while scrolling with the scroll bar.
I've seen a thread from 2002 where someone had the same exact problem as me,
but there was no solution posted to it.
Is this a known bug? any way to fix it? Tag: Cut, Copy, & Paste Menu Tag: 66229
Binding an indexer to the columns of a DataGrid
I have an ArrayList (myArrayList) in which each element is an object of a
custom class called DataRecord. DataRecord only exposes its internal data
in the form of an indexer. During runtime, I need bind myArrayList to a
DataGrid to display all elements of the ArrayList in the DataGrid. The
number of elements of the DataRecord indexer is only known at runtime.
I can of course do this...
dataGrid.DataSource = myArrayList;
But how can I programmatically specify that I want to set the indexer of
DataRecord as the data to be displayed in the columns of the DataGrid? Can
I set the .MappingName property of each column one-by-one somehow?
Thanks,
Bruce Tag: Cut, Copy, & Paste Menu Tag: 66227
Thread vs Asynch Remote call
I'm using .NET remoting with SAOs from my WinForms
client. For screen initialization and other processing,
should I use a separate thread to call my remote
operations, or should I call my remote objects
asynchronously?
By the way, my code has nothing to do while I'm waiting
for these calls. If I had a function to perform between
responses, then I believe the answer would be obvious to
make my Remote calls asynchronously.
Thanks for the help,
Todd Tag: Cut, Copy, & Paste Menu Tag: 66224
Control Drawing Issue
I have created a transparent control and I am using to to create drawing objects Inside the transparent objects I have created I am trying to using the draw shapes oval, rectangle etc. An example would be like in word are when you drag an oval onto the screen, the drawing resizes as the control does. The problem I am running into is actually drawing the rectangle. I am attempting to use this code here:
Rect = new Rectangle(this.Bounds.X - 10, (this.Bounds.Y -10), (this.Bounds.Width - 10), (this.Bounds.Height - 10))
I have placed this code in the Resize event. It does draw, however it seems to be reponsive to the bounds of it's container rather then the control itself. What I could like is if someone can help me figure out how to draw a rectangle close to the edges of the custom control and the drawing would resize itself as the control does. Please help!!! If anyone has any examples please email them mikestarkey@hotmail.com Tag: Cut, Copy, & Paste Menu Tag: 66223
Control Drawing Issue
I have created a transparent control and I am using to to create drawing objects Inside the transparent objects I have created I am trying to using the draw shapes oval, rectangle etc. An example would be like in word are when you drag an oval onto the screen, the drawing resizes as the control does. The problem I am running into is actually drawing the rectangle. I am attempting to use this code here:
Rect = new Rectangle(this.Bounds.X - 10, (this.Bounds.Y -10), (this.Bounds.Width - 10), (this.Bounds.Height - 10))
I have placed this code in the Resize event. It does draw, however it seems to be reponsive to the bounds of it's container rather then the control itself. What I could like is if someone can help me figure out how to draw a rectangle close to the edges of the custom control and the drawing would resize itself as the control does. Please help!!! If anyone has any examples please email them mikestarkey@hotmail.com Tag: Cut, Copy, & Paste Menu Tag: 66222
Add WebService reference at Runtime?
Is it possible to add a reference to a webservice programmatically in a
Windows Form application?
Basically I am looking to provide a list of URLs to the WinForm client which
would then add the WebReference, do the discovery, and call a WebMethod.
Any insight would be appreciated.
thanks in advance...
RL Tag: Cut, Copy, & Paste Menu Tag: 66220
Need help. Having trouble locating GDI+ exception in Windows Forms.
I have a multi-threaded managed MFC C++ application that is using GDI+
through .NET.
I am loading successive JPEGs into a Bitmap object in one thread and
displaying them into a Windows Forms PictureBox control in another thread.
Mutexs have been put in place to protect the Bitmap object and PictureBox
from possible collision. However, I occasionally getting an unhandled
Windows Forms exception that I cannot seem to locate and it is baffling me
because the stack trace does not show any of my code layers. This exception
is highly unpredictable, and ususally occurs when the application is run for
the first time (Maybe before the IL is converted to native by JIT).
The exception is below. I am hoping that someone might see something
familiar here and could explain why this is happenning. Note that the
managed C++ application also has a main native MFC dialog window that
displays a managed .NET forms window.
The exception dump is as follows:
************** Exception Text **************
System.InvalidOperationException: The object is currently in use elsewhere.
at System.Drawing.Graphics.EndContainer(GraphicsContainer container)
at
System.Windows.Forms.DibGraphicsBufferManager.ReleaseBuffer(GraphicsBuffer
buffer)
at System.Windows.Forms.GraphicsBuffer.Dispose()
at System.Windows.Forms.Control.WmPaint(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)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
LogFile
Assembly Version: 0.0.0.0
Win32 Version: 1, 0, 0, 1
CodeBase: file:///C:/dvr/LogFile.dll
----------------------------------------
DVR
Assembly Version: 0.0.0.0
Win32 Version: 2.0.0.0
CodeBase: file:///C:/dvr/dvr.exe
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
FrameGrabber
Assembly Version: 0.0.0.0
Win32 Version: 1.0.0.1
CodeBase: file:///C:/dvr/FrameGrabber.DLL
----------------------------------------
Microsoft.VisualC
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.3052.4
CodeBase:
file:///c:/winnt/assembly/gac/microsoft.visualc/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualc.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
GDIPlusEx
Assembly Version: 1.0.1495.16797
Win32 Version: 1.0.1495.16797
CodeBase: file:///C:/dvr/GDIPlusEx.DLL
----------------------------------------
System.Runtime.Remoting
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.runtime.remoting/1.0.5000.0__b77a5c561934e089/system.runtime.remoting.dll
----------------------------------------
DVRGUI
Assembly Version: 1.0.1495.16885
Win32 Version: 1.0.1495.16885
CodeBase: file:///C:/dvr/DVRGUI.DLL
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///c:/winnt/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
----------------------------------- Tag: Cut, Copy, & Paste Menu Tag: 66219
Does anyone have a link where I can get code for the cut,
copy, and paste menu of a MDI application?