Problem with FileSystemWatcher/Tray Notifier App
Hi,
I've been developing an application in VB.NET that uses the
FileSystemWatcher and a popup notification in order to tell me when files
have been downloaded.
The FileSystemWatcher code in my project is basically the same one thats
floating all over the VB.NET sites (by Jayesh Jain). The popup notification
(called TaskbarNotifier) is a class originally by John O'Byrne written in C#
and C++ but ported to VB.NET by Patrick Vanden Driessche. It was downloaded
from codeproject.com.
Both of these elements (FileSystemWatcher and TaskBarNotifier) work
perfectly on the own but I experienced problems when I tried incorporating
and combining them in my own project.
Basically, the FileSystemWatcher will detect files created, changed, deleted
etc and the TaskBarNotifier will display popups as it should. The problem
comes when I create a file (by means of downloading it or by just copying it
to the 'watched' folder directly). I've coded it so the TaskBarNotifier
should popup with name of the file created/downloaded then disappear after 3
seconds. It should, but doesn't. I can't understand why the same code will
not run when used under a different procedure.
I would of prefered to paste the code here in the hope people willing and
able to help can paste it directly into their own VB.NET environment but the
project contains bitmaps (as Embedded Resources) for the skins of the popups
and they need to be included when compiling/testing the app otherwise it
won't compile. So for this reason I've posted the project on my website for
download.
Homepage: http://www.geocities.com/toffee_paul/fun_d_mental.html
Direct Link: http://www.geocities.com/toffee_paul/vbnetproj.zip
When compiled and the form is displayed, click 'Test just the Popup' and the
popup will appear as it should. Now change the 'watch folder' to a valid
folder and copy a file to this folder. The app will detect the newly
created file (as proven in the 'content' textbox) but the popup will fail to
appear. Very strange problem.
Any help is very much appreciated,
Thanks
Paul Tag: printing code without windows generated Tag: 82232
Webbrowser Hide Bug (Solution)
I don't think anybody has ever come up with a satisfactory solution to the
bug where the webbrowser control, hosted in an MDI child, breaks when the
form is hidden and reshown. I think this problem also sometimes manifests
itself in non-MDI forms too.
The solution I came up with was very simple and seems to work perfectly.
State is maintained perfectly and you don't have to reload the page or
anything.
1) Wrap the webbrowser control in your own UserControl (I recommend the
WebOCHostVB... search for it in MS KB... Article ID 311303).
2) In the usercontrol's HandleDestroyed event remove the webbrowser from the
Controls collection (and add it back in the HandleCreated event). This
prevents the orphaning of the webbrowser window.
Private Sub WebOCHostCtrl_HandleDestroyed(ByVal sender As Object, ByVal
e As System.EventArgs) Handles MyBase.HandleDestroyed
'detach the browser
If Not webBrowser Is Nothing Then
If Me.Controls.Contains(webBrowser) Then
Me.Controls.Remove(webBrowser)
End If
End If
End Sub
Private Sub WebOCHostCtrl_HandleCreated(ByVal sender As Object, ByVal e
As System.EventArgs) Handles MyBase.HandleCreated
'attach the browser
If Not webBrowser Is Nothing Then
If Not Me.Controls.Contains(webBrowser) Then
Me.Controls.Add(webBrowser)
webBrowser.Width = Me.ClientRectangle.Width
webBrowser.Height = Me.ClientRectangle.Height
End If
End If
End Sub
That's it! Tag: printing code without windows generated Tag: 82231
Resource Files, Satellite Assembly - newbie
This has been bothering me for the last couple of hours.
Here is what I would like to do.
I want to create a sample when a button is clicked, depending on Culture I
would like to display the flag.
What I did was create a resx file using ResxResourceWriter and AddResource
Method. I included few countries' flags in the resx file. I used resgen to
create the .resource file.
I am using the following lines of code:
rm = New ResourceManager("MyImages", Me.GetType().Assembly)
and
PictureBox1.Image = CType(rm.GetObject("MyImage", ci), System.Drawing.Image)
Using the reseditor I could see the bitmap files in the file. When I run the
sample I keep getting the error -
**********************************************
An unhandled exception of type
'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll
Additional information: Could not find any resources appropriate for the
specified culture (or the neutral culture) in the given assembly. Make sure
"MyImages.resources" was correctly embedded or linked into assembly
"ResourceFileSample".
I tried including the .resources file in the peoject, compiled but still got
the same error.
I tried creating the resource dll and included in the reference but no change.
I have the subdirectories created for the test Cultures an d created the
corresponding resource files.
Is my understanding wrong? Please help or any links that I can look into
will be a great help Tag: printing code without windows generated Tag: 82227
textbox data entry
I enter data into several textbox's. and try to save it to a SQL table using the following code:
Before this code is executed I do a 'sqlDataAdapter->Clear', and then enter the new data.
private: System::Void btnOSave_Click(System::Object * sender, System::EventArgs * e)
{
void UpdateDataSet(DataSet* dsOwnerAnimal1);
// Check for changes to the dataset
if(!dsOwnerAnimal1->HasChanges(DataRowState::Modified)) return;
MessageBox::Show("we got here 2");
// Create a temporary Dataset
DataSet* xOwner;
MessageBox::Show("we got here 3");
// Get the changes to the data (Modified Rows Only)
xOwner = dsOwnerAnimal1->GetChanges(DataRowState::Modified);
MessageBox::Show("we got here 4");
// Check the Dataset for Errors
if(xOwner->HasErrors) {
MessageBox::Show("There were Errors, Did not Update!");
return;
}
This does not work because I get no data into the dsOwnerAnimal1 dataset. Can someone tell me what I am doing wrong?
Norm
--
Message posted via http://www.dotnetmonster.com Tag: printing code without windows generated Tag: 82220
Check multiple radion buttons in panel
I have a vb.net 1.1 winforms app and have several radio buttons in a panel
control. I want to be able to check several of the buttons at the same
time, but their behavior is that when I check one the other button becomes
unchecked so its not possible to have 2 checked at the same time. Is there
a way to work around this?
Thanks.
--
moondaddy@nospam.com Tag: printing code without windows generated Tag: 82217
Detect when owned form is brought to front?
Sorry about the last post -- I hit Enter by accident...
I have the following code ('this' is a non-MDI Form):
Form form1 = new Form();
form1.Owner = this;
form1.Show()
Form form2 = new Form();
form2.Owner = this;
form2.Show();
The behavior is that form1 and form2 are sort of child forms of 'this'
form. When the above code is executed, form2 is in the front, and I'd
like to check when the user clicks on form1 to bring it to the front.
I guess I was assuming that this was the 'GotFocus' event but this does
not work. Is there a 'ZOrderChange' event, or what is it?
Thanks. Tag: printing code without windows generated Tag: 82213
Visual C# Unable to alter size or position of form
Hi
I have this in a method which is called when my form is created
public CreateDevice()
{
// Set the initial size of our form
this.Top = 0;
this.Left = 0;
this.Size = new System.Drawing.Size(500,800);
//this.ClientSize = new System.Drawing.Size(400,300);
// And it's caption
this.Text = "Rhubarb: CreateDevice";
// Load our icon from the resources of the .exe
this.Icon = new Icon(this.GetType(), "directx.ico");
}
the method is being called OK, because the forms text is being set to
what ever I want it to be. But attempts to set the Top, Left or Size
members are having no effect at all, the same with attempts to set the
ClientSize member.
I can resize the form by dragging, when it is running.
I am completely new to C# so it may be something really dumb.
Any ideas
Kevin R. Tag: printing code without windows generated Tag: 82208
Determine CAPS LOCK state in VB. NET
Is there any way to determine the CAPS LOCK state in VB. NET, without
calling any VB6-style Windows API? Tag: printing code without windows generated Tag: 82206
How can I profile or check the performance of winforms hosted by IE?
Hi,
I'm working with "Smart Client" technology ... meaning I'm developing
Winforms application embedded in IE.
In my form, there are a bunch of controls and objects that connects to
SQL DB Severs and to WebServices just like other rich client
application.
Smart client development process was really tough but had to ran
through it.
Since now debugging process is on its edge, I'm planning to optimize
my Winforms application (embedded in IE).
So...I wonder is there anyway to check the performance of "Smart
Client".
I just want to optimize my app's code to enhance performance.
Especially I want to check the memory usage, cpu usage, time consumed,
object created based on each line of code execution.
Is this possible? Please consider this is unusual situation(winforms
in IE).
Any suggestion would be appreciated. TIA. :)
Regards,
Ryan Tag: printing code without windows generated Tag: 82204
mdi client problems - second try
In our app (VB) client forms are displayed based on what is on the current
client form and the button pressed. A user never selects a client form. You
can think of this process as filling out a very long form with many branches
(e.g., IRS form 1040). Once a client form is loaded it is never unloaded -
just hidden.
I need help resolving these 2 problems:
1) Focus on a text box. I know i can't set the focus in the Load event but
the Activated event only fires when the first client loads. Also, when the
form is redisplayed (i.e., made visible) txtbox.focus, for example, doesn't
work. What I do now is start a timer with a 10ms interval and set the focus
in the timer event. I also think that sometimes when I leave the text box the
Leave event doesn't always fire. There's got to be a better way.
2) Client form size. I would like the client form to be the maximum size
that will fit in the MDI parent. The minimum size of the client forms is set
to 720 X 540. If i set the WindowState to Maximized the first client is
displayed maximized but all the others are displayed at their minimum size.
When the first client form is redisplayed it is also displayed at the minimum
size. This just drives the users crazy. What I've done is after showing the
form the first time or making the form visible on redisplays I set the
child.Dock = DockStyle.Fill. I also do this if the
parent is resized. Now the client is almost maximum size except it still has
its own margins.
--
tsiGeorge Tag: printing code without windows generated Tag: 82203
About smart client authentication
Suppose I want to implement a single windows form as a smart client
for scanning and editing, uploading images to webserver...since this
is going to be a web deployed windows form...and basically i will have
a link on the web form for this windows form to be loaded(web
application uses webform authentication by backend database)..now when
the user clicks the link for the windows form i need to check that the
user is authenticated...is there a way where i can integrate my
webapplication's authentication into this windows form..is there a way
to access session variables within the windows form and/or
cookies...is there a way to inherit asp.net multi threading feature
into this form??...or do i have to implement multithreading myself??if
so how do i do that??...i am clueless about windows applications.
I just want to know how people are autheticating users in smart client
Any help will be greatly appreciated.
TIA. :) Tag: printing code without windows generated Tag: 82199
Problems Positioning Toolbars
Hi
I am self learning .VB .Net and have encountered a requirement that is not
illustrated in any of my texts.
I have three toolbars which can be present in any combination from 0-3
They are quite small and when there are two or three I would like the first
pair to lie alongside each other
I have been fiddling for ages with code to do this. The latest version is
listed below. It always leaves three toolbars full width stacked vertically.
I would be grateful for some advice on how to achieve this.
Yours with thanks in anticipation
Roger Stenson
'Current Code
If (CurrentUser.UserStatus = "Authenticated") And (CurrentUser.UserLevel =
"Administrator") Then
'Basic Toolbar
tbrBasic.Visible = True
tbrBasic.Enabled = True
tbrBasic.Size = New Size(233, 16)
tbrBasic.Location = New Point(0, 0)
'User Toolbar
tbrUser.Visible = True
tbrUser.Enabled = True
tbrBasic.Size = New Size(233, 16)
tbrUser.Location = New Point(224, 0)
'Administrator Toolbar
tbrAdministrator.Visible = True
tbrAdministrator.Enabled = True
tbrBasic.Size = New Size(233, 16)
tbrUser.Location = New Point(0, 17) Tag: printing code without windows generated Tag: 82198
AfterCheck event for TreeView control
Hi,
I registered event handler to catch the AfterCheck event...
myTreeView.AfterCheck += new TreeViewEventHandler(myTreeView_....);
It works fine, however, if I set the checkbox as true or false
programatically(I mean..in the code, somethinglike node.Checked = true...),
aftercheck event
wasn't fired. Of course, if I checked the checkbox by mouse or keyboard, the
event was fired. However, again, programatically set checkbox didn't invoke
the aftercheck event.
Am I missing something?
Any suggesion would be appreciated.
Thanks.
...............................................TJ Tag: printing code without windows generated Tag: 82197
Wrong Application Icon Task Switch
I have a C# application with one and only one icon in the project. The icon
is linked as the application icon in Project Properties and is also linked
with each windows form.
The icon is displayed properly on the desktop, in the task bar, and on the
form itself. However, when you task switch (Alt+Tab) the icon is replaced
with a generic icon. Why? How do I get the proper icon to show on the task
switch dialog?
--Kevin Tag: printing code without windows generated Tag: 82196
After form loads event
Hi
This question is probably one of the basic things but being a novice
programmer in c# and .NET environment, I couldn't get to find the answer.
I have a menu item in one form and need to create the context menu with tht
menu item in another form. The first form becomes the parent form for the
second form after the second form is loaded. So, I need to know what event
could be used as load event is called when the form is still in the process
of loading.
Thanks Tag: printing code without windows generated Tag: 82194
changing look and feel of an app
I would like to know if there are any examples, tutorial on how to
completely change an application's look and feel. By that I mean the
colors, the way menus are drawn, the way tool bar items are spaced in a
tool bar, the way tab identifiers are shaped, etc., etc.
There are a few interesting 'LAFs' such as MS Money 2005, MSN Messenger
6.2, Office 2003...just to name a few basic ones. I would like to have
one of my graphic designer friends do a mock up in photoshop then
produce an application that looks like it (I'm assuming it all has to
be done programatically so designers would have to resort to something
like photoshop).
I also understand that part of the reason the aforementioned
applications look the way they do is because of controls which are not
available publicly...despite that, if designer can create websites
(with primitive components) that can draw powerful and diverse
emotional reactions, I don't understand why rich client GUIs have to
look so ugly and gray (obviously 'consistency' has its place too).
Any way, it will be even better if someone can point me to publicly
available LAFs, the way we are starting to see them for the Java/SWING
community.
Thanks! Tag: printing code without windows generated Tag: 82190
Overriding OnPaint with a ListView
Hi all,
here is what I want to do:
I've got a ListView populated from a database.
The problem is that there is two much items generated...
So I wanted to only get additionnal data (all the colums) for the painted
items.
To do so I created my own ListView class derivated from the original one and
I've overriden the OnPaint method.
BUT this function's never called............
Somebody knows why?
Or even more, sombedy would have another solution to solve my problem?
Thanks in advance!!! Tag: printing code without windows generated Tag: 82189
Use Outlook 2003 buttons, etc.
How can I develop a windows application that uses controls in Office 2003,
especially Outlook.
Jay Tag: printing code without windows generated Tag: 82186
View of ListControl Item
I have a ListControl on a window where the text will get clipped. The user
can not see the full text nor can he scroll to view it.
Questions:
1) Is there a Windows "standard" that is used for a work around.
2) Is there a way to know which item the mouse is hovering over and put
up a display in a tool tip type window. I can't find a way to access the
Scollbar to find out the vertical scroll on the window.
I would prefer to stay away from a Combo box look as the list control is for
display purposes and is not used for selection.
Thanks,
Marc Tag: printing code without windows generated Tag: 82185
embedded resource
Hi,
How to to create an object (like Cursor) from a .Cur file embedded in a dll
of C# classes?
Thanks in advance,
Pascal Tag: printing code without windows generated Tag: 82181
Division By Zero Exception in MonthCalendar.GetMinReqRect(..)
Hi all,
My prog throw this exception when I add the parent control of the calendar
into the main control collection.
But It does not throw it at every launch of the application... !!!!
So does it means that it's a memory problem or something?
I would give any further information if someone could help me out of this :)
Thanks in advance! Tag: printing code without windows generated Tag: 82179
monthcalendar
Hi,
is it possible to display specifik days in another color
(red) in the monthcalendar? I know it is possible to
display specifik days in bold, but can I change color as
well?
Thanks
Julia Tag: printing code without windows generated Tag: 82177
data entry (Visual C++)
I built a Winform with several textbox's. I am using sqlDataAdapter. My
DataSet is "dsOwnerAnimal1". I have some records in the sql table and I can
display them with "Fill, Next and Previous". I clear the DataSet with
'dsOwnerAnimal1->Clear();' and the I enter data into the textbox fields. I
then GetChanges and do the update. First I check for changes 'HasChanges'
this always fails. Do I need to somehow put the DataSet into insert mode or
something? Help!!
--
Norm Bohana Tag: printing code without windows generated Tag: 82176
sqlDataAdapter Insert C++
I have built a winform project using Visual C++, and I do not know how to
build an insert. I cannot find an example or how to code one in the
documentation. I can use the fill (sqlDataAdapter2->Fill(dsOwnerAnimal1);). I
need help.
Norm Bohana Tag: printing code without windows generated Tag: 82174
datagrid column headers and size?
i have a datagrid that is getting it's dataset from a mysql database. is
there a way to change the header label and a way to set each columns width
before it is displayed? there are 4 columns being displayed and i need to be
able to rename 2 of the columns and set the width of them too.
thanx in advance Tag: printing code without windows generated Tag: 82168
Shortcut Key question (i.e. "&Submit")
I have a Button on a WinForm that has a text property = "&Submit".
I noticed that whenever I pressed the "S" key only (without pressing the
"Alt" key) the Button's click event would fire. I thought that it was only
supposed to fire if the combo "Alt+S" was pressed.
My problem is that I have another control (a DataGrid) that is suppoed to
respond to the "S" key being pressed and I don't want the Button's click
event to be fired. I only want it to be fired if the combo "Alt+S" is
pressed.
Any suggestions? Tag: printing code without windows generated Tag: 82167
A Bug in .NET Framework/Windows Forms
Anyone who sees this
We have been grappling with this problem ever since we ported to .NET.
Microsoft says that MenuItem event handlers are not garbage collected, since
they are not "closely tied" to the forms. Although they keep holding the
refrence to the forms and it causes the forms to not dispose. So the user
objects and GDI object counts keep riising.
Apparantly they dont think its an issue and the users have to add handlers
for menu item events and then remove the handlers manually.
If anyone has come across this issue and know of any other solution besides
Microsoft's then please post it. Tag: printing code without windows generated Tag: 82166
ICustomTypeDescriptor.GetEditor - Which property am I on??
I have a class that will be edited via the CollectionEditor/CollectionForm
UI. To that extent I have defined the various properties I want editable for
my class. However, three of the properties are of type string but I would
like them edited by selection from a dropdown list whose contents are
determined at runtime.
It looks like I might be able to use the ICustomTypeDescriptor interface to
do what I need. In particular, if I could override the GetEditor method to
create a specialized UITypeEditor for these three properties then I think
this would do the trick.
The only problem is that I cannot see how I know, when GetEditor is being
invoked, which property it is being invoked for!
Thanks,
-- TB Tag: printing code without windows generated Tag: 82165
How to select datagrid cell
This sounds very simple, but I'm having trouble getting it to work.
When I display a WinForms datagrid, I want the value in the first row
and column to appear in reverse image. I have tried setting the
CurrentCell, focusing the grid, getting the textbox and tried to select
the text, etc. Each time with no luck. When I press the Tab key to
tab through the cells, then the cells are reverse-imaged. But I need
it that way on initial display. Tag: printing code without windows generated Tag: 82164
Simple Data Grid DataSource Problem
I want to use a data grid in a MFC Project.
After adding the grid to an empty dialog, I did not find a way to connect to
a data source: The DataSource textbox stays empy (I added all kind of
Connections and Commands). The help systems says that ADO is to use, but if
found only Microsoft ADO Data Control 6.0 (SP6.0) (OLEDB) and if I add this
to the dialog I get: "File or assembly name AxInterop.MSadodclib.dll or
dependency was not found".
What can I do? Tag: printing code without windows generated Tag: 82163
CollectionEditor: How to turn on "description" panel?
If I use a PropertyGrid directly, the "description" panel is available and
can be turned on and off and resized, etc. But if I use a CollectionEditor,
the property grid displayed there doesn't appear to honor the request to
display the "description" panel even though the properties of the items in my
collection all have description attributes.
How can I get the description panel for the property grid portion of the
CollectionEditor to be displayed?
Thanks!
-- TB Tag: printing code without windows generated Tag: 82161
CollectionEditor: How to specify arbitary list of values for prope
I have a collection of items that I allow the user to edit by bringing up a
CollectionEditor. The editor conveniently displays all the properties of my
item class and works pretty well. However, I am changing one of the
properties from being of an enumerated type to being a string value that
should be set from a list of possible values determined at runtime.
The enumerated value is automatically handled by the PropertyGrid as a
dropdown list. How can I override this behavior to supply the list of
allowed values at runtime? I have been successful at plugging in my own
derivation of a UITypeEditor for this property but I cannot figure out how to
supply the instantiated type editor the list of values to display in the
dropdown.
Thanks!
-- TB Tag: printing code without windows generated Tag: 82160
WinForms question...
Hi!
How do I determine the windows standard vertical scrollbar width in pixels
(set from the display properties) from c# code?
Peeter. Tag: printing code without windows generated Tag: 82155
Scrolling during a Drag Operation
Hello all,
I have a UserControl that is in a Panel. The Panel's AutoScroll is
set to true. When the user drags data over the Panel and hits the
edges, I want the control to scroll.
I've managed to get this all to work. But I have a few questions:
- Is there a standard distance from the edge of the window that the
mouse should be before scrolling starts?
- How much does one scroll each instance? I've tuned mine to match the
speed of the machine I'm doing development work on... Obviously this
may not work for others.
And one technical question. To do the scrolling I adjust the
AutoScrollPosition property while handling the OnDragOver event. If I
do this every time the OnDragOver event is fired, my scroll bars move,
but nothing is re-drawn (until the scroll bars go as far as they can).
On the other hand, if I update the auto scroll position every other
time OnDragOver is fired, then everything works as expected: the scroll
bars move and the panel is updated. This seems odd, and I find no
details on this in the documentation or in a search of the newsgroups.
One other question. What is DragDropEeffects.Scroll used for? Is
there any point to it? Or is it just there in case you want to change
cursors.
Finally -- I'm doing my scrolling in OnDragOver. Should I do it in
GiveFeedback instead? I'm a little unclear how the framework expects me
to seperate the tasks (currently, since I have no special cursors, I do
implement GiveFeedback).
Cheers,
Gordon.
Point mouseCurrent = PointToClient(new Point (drgevent.X, drgevent.Y));
///
/// Is it time to scroll (if possible)? Skip every other call to give
/// the rest of the update framework a chance to catch up.
///
//// _lastDidIt switches from true to false on each call, it is a
method variable.
int dragboarder = 20;
int dragscrolldist = 5;
if (mouseCurrent.Y > Height-dragboarder)
{
if (_lastDidIt)
AutoScrollPosition = new Point (-AutoScrollPosition.X,
-AutoScrollPosition.Y+dragscrolldist);
}
if (mouseCurrent.Y < dragboarder)
{
if (_lastDidIt)
AutoScrollPosition = new Point (-AutoScrollPosition.X,
-AutoScrollPosition.Y-dragscrolldist);
}
if (mouseCurrent.X > Width-dragboarder)
{
if (_lastDidIt)
AutoScrollPosition = new Point
(-AutoScrollPosition.X+dragscrolldist,
-AutoScrollPosition.Y);
}
if (mouseCurrent.X < dragboarder)
{
if (_lastDidIt)
AutoScrollPosition = new Point
(-AutoScrollPosition.X-dragscrolldist,
-AutoScrollPosition.Y);
}
_lastDidIt = !_lastDidIt;
///
/// Make sure everything is re-drawn.
///
Invalidate(); Tag: printing code without windows generated Tag: 82150
Scrolling in DataGridView in Visual Studio 2005
Microsoft has confirmed that this is bug with VS 2005. So we can keep
our fingers crossed till they give us the solution.
Refer the link for more details
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=2ce60503-bf84-44d0-af9f-ee26b6f1ad21
--
Thanks
Arvind Tag: printing code without windows generated Tag: 82148
Problem with databinding and RowChanging event
I created a method to handle the RowChanging event to validate some data in
a databound form. I am using BindingManagerBase.EndCurrentEdit to trigger
the RowChanging event. If the data cannot be validated then an exception
is raised in the RowChanging event and catched after the call to
EndCurrentEdit. The problem I am having is that after calling
EndCurrentEdit and raising the exception inside the RowChanging handler,
the values in the controls in the form that are not modified again are not
fetched again. For example...
I have a form with 2 edit boxes which are data bound. Edit1 and Edit2.
The original values for each are "mary" and "smith" respectively. If I
modify Edit1 to contain "John" and call EndCurrentEdit, the RowChanging
event is fired. If I check the Current version of the column it contains
"Mary" and the proposed version contains "John". If I raise an exception
within the event handler then the data is not saved to the dataset as
expected. At this point I still have the edit boxes containing "John" and
"Smith"... I am not calling CancelCurrentEdit because I don't want to roll
back to the current values... I am simply letting the user know that the
data entered is incorrect.
If at this point I edit the Edit2 to "Roberts" and call the EndCurrentEdit
method, the RowChanging event is fired... but if I check the proposed
version of the Edit1 bound column, it contains the Current value "Mary" and
NOT the value currently in Edit1. If the user does not edit the Edit1
control directly, the value is not reflected when EndCurrentEdit is called.
Thanks,
Jeronimo Tag: printing code without windows generated Tag: 82147
Design-time control options
Hi all,
How can I show checkbox for bool properties of my custom control in
design-time. The usage of DesignerVerb shows just plain MenuItem.
I am wondering how TextBox control shows a CheckBox for MultiLine option.
(See a TextBox control and its MultiLine option in VS.NET 2005 Windows Form
Design Mode)
Yongkee Tag: printing code without windows generated Tag: 82146
Webbrowser control + MDI + Disable ctrl-n
I am using the Webbrowser control in a MDI application. The Webbrowser
control is in a User Control which is loaded into a form. I have
implemented IDocHostUIHandler for the User Control and have set the
SetUIHandler to the User Control (this). I have also disabled ctrl-n by
implementing TranslateAccelerator.The problem is, as the mdi form is
loaded initially, I can do ctrl-n and it will popup a new IE browser.
Once I click anywhere on the browser, then disables ctrl-n. Any ideas? Tag: printing code without windows generated Tag: 82145
Hosting .NET Windows forms UserControl in IE
Hello,
I need to host .NET Windows forms UserControl in Internet Explorer. I do it
by including <OBJECT> tag in my aspx page:
<OBJECT id="mycontrol1" classid="MyControl.dll#MyControlNamespace.MyControl"
width=800 height=300 style="font-size:12;" VIEWASTEXT>
</OBJECT>
everything works fine, MyControl.dll gets downloaded into the download cache
and IE displays the control. The problem however is the fact that the browser
needs to download MyControl.dll file. Our clients will block downloads of
.DLL and .EXE files. I would like to use CAB file instead, for example, I
tried codebase attribute as in the following:
<OBJECT id="mycontrol1" codebase="MyControl.cab"
classid="MyControl.dll#MyControlNamespace.MyControl" width=800 height=300
style="font-size:12;" VIEWASTEXT>
</OBJECT>
but it does not work.
Is there a way of making IE to download a CAB file, just as it does for an
ActiveX components, and extract contents into the download cache, so that no
DLL file needs to be downloaded?
Thank you,
Slava. Tag: printing code without windows generated Tag: 82143
Combo Control array - Selection
hello ,
I have created a Control array for a ComboBox to populate on a tabPage .
My concern is that I 'm using a List to populate the Combo Box like this ..
ComboArray[i].Items.Add(List[i)];
ComboArray[i].DataSource = List;
The Combo Box gets populated with all the values in the List ( Thats what I
wanted )
But when i select a value in the First Combo box the Changes reflects in all
the boxes created
Example
if if there were 6 values from 1,2,3 ..6 in the all Combo Dropdown list .
when I select 5 in the 3rd all the Combo's selected value changes to 5.
How do I get specifice values in different Combo According to my selection ?
Thanks
Sylesh Nair Tag: printing code without windows generated Tag: 82140
Getting ToolTip from a control..
In a control it is usefull in some cases to know if it is included on a
toolTip, HelpProvider etc. How do you access this information?
I have the code below which uses reflection to pickup the IContainter named
"Components" that the windows designer uses and this seem to work but I am
wondering if there is a way to do this without using reflection?
Anyone else have a better way of doing this???
/// <summary>
/// Method: This gets the ContainerControl and then looks for an
/// IContainer field named "components"
/// used by the windows designer. It uses reflection.
///
/// (can be used to look for ToolTips, ErrorProviders, HelpProviders etc)
/// </summary>
/// <returns></returns>
public IContainer GetContainerComponents(Control control)
{
IContainer components = null;
try
{
if (control.Container != null)
{
components = control.Container;
}
Object containerControl = control.GetContainerControl();
if (containerControl != null)
{
//Using Reflection to get components...
BindingFlags binding = BindingFlags.Instance
| BindingFlags.NonPublic
| BindingFlags.Public;
FieldInfo componentField
= containerControl.GetType().GetField("components",binding);
if (componentField != null)
{
components
= (IContainer)componentField.GetValue(containerControl);
}
}
}
catch {}
return components;
}
//Eg: Deactivates toolTips for a Control in
private void DeactivateControlToolTips(Control control)
{
IContainer components = GetContainerComponents(control);
foreach (Component child in components.Components)
{
if (child is System.Windows.Forms.ToolTip)
{
if ( ((System.Windows.Forms.ToolTip)child).GetToolTip(this).Length > 0)
{
((System.Windows.Forms.ToolTip)child).Active = false;
}
}
}
} Tag: printing code without windows generated Tag: 82134
Winform scrollbars and Maximize
I have an MDI application that has 4 child windows.
When my application opens, it initialially opens all of the forms
un-maximized. When I then choose to maximize all of the windows and then in
my code switch the app to one particular window, that one window does not
appear maximized.
Instead, I have to double-click on the title bar and then in the control box
I see the option to maximize. Otherwise the control box shows what appears
to have 'restore' capability. Not sure if this explaination makes sense.
I have the autoscroll set to true on the window because the controls on the
window go down farther than the height of the window. Is there something to
do with the autoscroll that could be causing this behaviour?
Thanks.
STom Tag: printing code without windows generated Tag: 82133
How to hide form without hiding its control?
Hi ..
How to make form invisible without hiding control on the form.
Thanx.. Tag: printing code without windows generated Tag: 82129
Need to retrieve font name instead of Typeface name
Dear Readers,
I need to retrieve the font name of a TTF file. When I use the
following code I retrieve the Typeface name but not the name I see on
the top of the preview screen when I doubleclick the TTF file. Does
anyone know how I can retrieve that name?
Dim _PrivateFontCollection As New _
System.Drawing.Text.PrivateFontCollection
_PrivateFontCollection.AddFontFile("C:\MyFont.TTF")
Dim FontName as String
FontName =3D _PrivateFontCollection.Families(Index).Name
Many thanks,
R=E9my Samulski Tag: printing code without windows generated Tag: 82128
How to handle WM_NCPAINT event in C#?
Hi All,
I need to draw on Non client area for that i need to handle WM_NCPAINT
event.
Please help me and send demo code if possible.
thanx
Amar Tag: printing code without windows generated Tag: 82123
Inherited User Control not showing in designer
I have a user control that inherits from another user control. The base user
control works fine in the designer, I can see all of the controls, etc...
However when I open the derived control in the designer, all I see is a grey
square with no controls. I have tried attaching to the IDE with another
instance's debugger, but no exceptions are being thrown when the control is
open.
Here is how the constructors are setup:
Base Control:
public class MyBase : System.Windows.Forms.UserControl
{
[Browsable(false)]
protected AnotherObject _oObject;
[Browsable(false)]
public AnotherObject oObject
{
get{ return _oObject; }
set{ _oObject= value; }
}
public MyBase()
{
_oObject= new AnotherObject ();
}
public MyBase (AnotherObject oObject)
{
InitializeComponent();
_oObject= oObject;
}
}
Derived Control:
public class MyDerived: MyBase
{
public MyDerived(AnotherObject oObject) : base(oObject)
{
InitializeComponent();
}
public MyDerived() : base()
{
}
}
Please help! Tag: printing code without windows generated Tag: 82118
Prompt if changes for databinding
Hi,
I am writting a data navigator where if the user edits a form and tries to
move to a different record on the dataset without saving the current
record, he is prompted to save it before the BindingManagerBase position is
changed. I created a navigator class that includes a dirtyRow flag to
check when the user selects to move to a different record.
I am trying to keep track of changes by adding events to TextChanged on the
edit boxes of my form. If a textbox changes then the dirtyRow flag is set.
However I am encountering some problems since the TextChanged event is also
fired when text is changed due to the databinding for the control. I added
an event for PositionChanged on the BindingManagerBase that sets dirtyRow
to false and in general this works because when the position is changed,
the databinding sets the dirtyRow to true on the TextChanged event but the
PositionChanged event is called after the TextChanged event and therefore
the newly visited row is not considered dirty until the user changes the
text on the edit boxes. However this does not work the first time the form
is created because in that particular case, the TextChanged event from the
databinding is called AFTER the PositionChanged event.
My question...
1- Is there any way of knowing IF the EndCurrentEdit will actually modify
the underlying dataset? I noticed that RowState for a row changes to
Modified after EndCurrentEdit if there are changes. I want to prompt the
user to keep or save changes only if changes exist.
2- Is there an event that I can use to know that databinding for the form
on the current position has completed so I can set the dirtyRow flag to
false?
Thanks,
Jeronimo Tag: printing code without windows generated Tag: 82116
Tabbing Into a Custom DatagridColumnStyle at ColIndex(0)
This is a duplicate post. I wanted to be sure to post in the managed group
to take advantage of my subscription.
Sorry for the initial mispost.
JT
Hello,
I am literally banging my head against the wall trying to figure out how to
use the tab key to move from the last column in a datagrid row to the first
column in the next row when that first column is a Custom DataGridColumnStyle
(in this case, as combobox). I have seen George Shepherd's suggestion on
subclassing the embedded control, and have tried three different ways of
doing this, as shown below. NONE of them work.
I think I know why...
After having tabbed through my datagrid, when I then look at the trace
for "Debug.WriteLine(keyData.ToString)", I see Tab for every move I made from
one column to the next ON THE SAME ROW. But when my tab key cause a new row
to become current, my debug trace shows nothing at all.
Question is, how to solve this problem. Can anyone enlighten me as to
exactly how the datagrid moves to a new row in response to the tab key?
Maybe if I can understand that, I can achieve what I am trying to achieve.
Thanks.
Public Class DataGridComboBox
Inherits ComboBox
Public Sub New()
MyBase.New()
End Sub
Public isInEditOrNavigateMode As Boolean = True
Protected Overrides Function ProcessDialogKey(ByVal keyData As
System.Windows.Forms.Keys) As Boolean
Dim dG As DataGrid = DirectCast(Me.Parent, DataGrid)
Dim curCell As DataGridCell = dG.CurrentCell
With curCell
Dim cNum As Integer = .ColumnNumber
Dim colIndex As Integer = dG.TableStyles(0).GridColumnStyles.Count - 1
Debug.WriteLine(keyData.ToString)
If keyData = Keys.Tab Then
'No more columns in row --> go to nbew row
If cNum = colIndex Then
dG.CurrentCell = New DataGridCell(.RowNumber + 1, 0)
Return True
'More columns in current row
Else
'Tab normally
dG.CurrentCell = New DataGridCell(.RowNumber, .ColumnNumber + 1)
Return True
End If
End If
End With
Return MyBase.ProcessDialogKey(keyData)
End Function
'Private WM_KEYUP As Integer = &H101
'Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
' If m.Msg = WM_KEYUP Then
' Return
' End If
' MyBase.WndProc(m)
'End Sub
'Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
' If m.WParam.ToInt32 = CInt(Keys.Tab) Then
' Return
' End If
' MyBase.WndProc(m)
'End Sub
'Private Sub DataGridComboBox_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
' If e.KeyData = Keys.Tab Then
' e.Handled = True
' End If
'End Sub
End Class
--
John
Expand AllCollapse All
--
John Tag: printing code without windows generated Tag: 82114
How can I print the code for a form without including the windows form
designer generated code?