Visual Inheritance: Can I add custom properties to properties window?
Hi,
I created base UserControl for visual inheritance. The base control includes
the following property:
[Category("Appearance")]
[Description("The button text")]
[DefaultValue("Hi")]
public string ButtonText {
get {return this.button1.Text;}
set { this.button1.Text = value; }
}
But the property "ButtonText" does not appears in property window.
How can I add property window support to my Visual Inheritance procatice?
Thank you,
Max Tag: How to change the size of the ErrorProvider hint Tag: 105934
Deployment/Debugging Question
Let me preface this by saying I've been primarily an ASP.Net developer
over the last few years and have just started working with Winforms.
My application will be a standalone program that will access FoxPro
database files. A typical installation would install my exe in
C:\Program Files\My Company\My Application. I want my database files to
go in C:\Program Files\My Company\My Application\Data. I've added the
Data folder to my project and selected the build action as content for
each Foxpro item inside it.
My question is with determining the path to the database files for my
connection string. I'll be able to determine the Data folder path using
Application.StartupPath. However, when debugging, the exe is compiled
and executed from the bin folder. Thus, the database path is incorrect
when using Application.StartupPath.
How can I simulate the install structure when developing and debugging? Tag: How to change the size of the ErrorProvider hint Tag: 105933
Getting list of Website from IIS "Web Sites" Folder
hi guys,
few days back i've posted a question regarding how can i get the list
of the websites form the IIS, at this location:
http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/97f4f07b8b46a397/41372cde30df29e7?lnk=st&q=how+to+get+list+of+websites+from+IIS+C%23&rnum=1&hl=en#41372cde30df29e7
and i got a nice replay. it worked.
now the problem is different when i tried the code on the different
webserver which has lots of websites but not under the "Default Web
Site" directory. most of the Websites are under the "Web Sites" folder.
and now i want to retrive all those websites list from the IIS. i tried
to get the type of the folder "Web Sites", but i didnt get anything out
of it.
can anyone tell me how can i get all of the websites from the folder
called "Web Sites".
Tools:
IIS 5.1 on Microsoft Windows Server 2003
C#.net 2005
thanks,
Lucky Tag: How to change the size of the ErrorProvider hint Tag: 105924
replicating tooltip functionality
I wish to create a tooltip style control to show information about items
being dragged in a tree view.
My problem is that I cannot capture the mouse in the treeview ( and hence
have the tooltip follow the mouse when it moves outside the treeview control
), presumably because once the tooltip is shown it becomes the foreground
window.
Any possible solutions would be welcome ( I have thought about wrapping the
Win32 tracking tooltip, but I require more sophisticated tooltip content than
just text ).
Thanks,
Andrew. Tag: How to change the size of the ErrorProvider hint Tag: 105923
Create a base maintenance form: design and implementation recomendations
Hi all,
I'm doing a WinForm Project for .NET 2.0 platform and have some design and
implementation questions for my UI interface.
I have recently discovered that some complex controls (like DataGridView)
doesn't works well with visual inheritance (it can't be modified directly in
the inherited form although visibility of the control is public or
protected).
Now I have to do some simple maintenance forms to update/insert/delete
users, companies .
All are very similar: a DataGridView with some columns, a "Cancel" button
and an "Update" button.
The DataGridView would be linked to a BindingSource Control and this to a
Typed Dataset.
What is the best approach to have a base maintenance form to avoid coding in
the descendant forms?
I want to edit the columns from the DataGridView for every maintenance form
to adjust titles, size .
Thanks,
Alex B. Tag: How to change the size of the ErrorProvider hint Tag: 105922
discarding user actions on a form while in busy state
Hi,
I can't seem to figure out a decent way to do this. I have a small
window, and I need to discard user input while performing some lenghty
task. For example, if the user wants to sync the app with a server, and
this takes time. The proper behavior would be to change the cursor to a
busy cursor, and prevent the user from touching any control on the
form. Of course, painting should still be done, and the form should be
able to move and resize (user actions like move, resize, maximize,
minimize). When the job is done, the cursor changes back to the default
one, and the user is able to interact with the received data.
I've seen various sugestions:
- disable the controls (or the whole form): not good, as the appearance
of the controls changes dramatically; also, there seems to be problems
with the cursor, it won't show properly on a disabled control (it
displays the default cursor, not the one I set);
- put a transparent form on top of the current form: I'm interested in
this, if anyone can provide bits of code, I would really appreciate it.
However, I don't know if this is supported on all systems (I'm
interested mainly in XP, Win2003, and maybe Win2000).
- catch all events in a WndProc: how do I do this? I've overriden the
WndProc of my form, yet not all messages pass through this. I am still
able to interact with the controls...
I really appreciate any help on this, guys (and girls). :)
Cheers,
Cosmin. Tag: How to change the size of the ErrorProvider hint Tag: 105920
AnimateWindow and popup window
I'mwriting a popup system for my application.
I'm using the win32 call ShowWindow to show my window.
Now I just stumbled on an other win32 call: AnimateWindow
And while that seems very appropriate for the popups it has the very
infortunate effect of showing a blank window!
All the child control have disappeared!
Any idea what going on?
--
Regards,
Lloyd Dupont
NovaMind Software
Mind Mapping Software
<www.nova-mind.com> Tag: How to change the size of the ErrorProvider hint Tag: 105917
instal basics
I can't install dot net charting ver4,
build solution without error but
in
public MainForm(){
InitializeComponent() <<<<< Error
......
}
Error= "Couldnot load file assembly 'dotnetCharting.winform", version
4.0.94892324, Culture=neutral, PublicKeyToken=c8374837849' or one of its
dependencies can not be found
Did i install incorrectly (if so please explain again for me) or my C#
express doesn't fit this dotnetcharting ver4 ?
Thanks Tag: How to change the size of the ErrorProvider hint Tag: 105916
ListView, ColumnHeader.Width when using multiple Fonts
Here is an issue I've been struggling with for a day now, I wanted to share
what happened with the group and find out if I have experienced (and worked
around) a bug, or if there is something that I missed. I am using Visual
Studio .NET 2003 with C#.
The goal: I need to make sure that in a ListView control, the columns are
drawn wide enough to display the text of the ListViewItems. Here's the
catch: ListViewItem.Font may not be the same as the ListView.Font.
Problem #1: ColumnHeader.Width does not take Font into account.
Should be easy... just use (ColumnHeader.Width = -1), right? Sorry, no.
Using the Width = -1 shortcut does not appear to take into account the fact
that one of the ListViewSubItems in that column may be using a font that is
wider than the ListView.Font.
Workaround #1:
I used ListView.CreateGraphics to create a graphics object, and then used
Graphics.MeasureString() like so:
// Assume listView.Font is "Microsoft Sans Serif", 8.25
// Assume listViewItem.Font is "Lucida Console", 8.0
Graphics g = listView.CreateGraphics();
foreach (ColumnHeader ch in listView.Columns)
{
ListViewItem.ListViewSubItem listViewSubItem =
listViewItem.SubItems[columnHeader.Index];
int neededColumnWidth = g.MeasureString(listViewSubItem.Text,
listViewSubItem.Font).ToSize().Width;
if (ch.Width < neededColumnWidth)
{
// Make the column wider
ch.Width = neededColumnWidth;
}
}
Problem #2: In the above example, the listViewSubItem.Font returns the same
value as listView.Font! I would have expected that listViewSubItems would
inherit their font from the parent ListViewItem by default.
Workaround #2: It is fortunate that the Font is identical for each element
of ListViewItem.SubItems, so I just substituted "listViewItem.Font" for
"subListViewItem.Font".
// Assume listView.Font is "Microsoft Sans Serif", 8.25
// Assume listViewItem.Font is "Lucida Console", 8.0
Graphics g = listView.CreateGraphics();
foreach (ColumnHeader ch in listView.Columns)
{
ListViewItem.ListViewSubItem listViewSubItem =
listViewItem.SubItems[columnHeader.Index];
int neededColumnWidth = g.MeasureString(listViewSubItem.Text,
listViewItem.Font).ToSize().Width;
if (ch.Width < neededColumnWidth)
{
// Make the column wider
ch.Width = neededColumnWidth;
}
}
Problem #3:
With the above code, I can see that the columns are indeed resizing to
become wider---but not quite wide enough to display all the text.
Problem #4:
Even when all the ListViewItems are using the same font as the parent
ListView, using (Width = -1) appears to jam the text against the right side
of the column---there is no padding on the right side of the column like
there is on the left.
After doing some research, I believe that this is related to some hardcoded
padding versions of .NET, similar to this bug which says, "Internally, the
Width of a ColumnHeader is padded with some predetermined constant when it is
changed programmatically. This padding is not in effect if the Width of the
ColumnHeader is changed through the user interface."
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B179988
This article implies that the hardcoded padding values are 29 for get_Width
and 30 for set_Width.
Final Workaround:
Whenever adding or modifying a ListViewItem or one of its SubItems, I also
call the following method instead of simply using (columnHeader.Width = -1;),
which appears to do the trick
/// <summary>
/// Ensures that each column in the list-view is wide enough to the given
text written
/// in the given font. Normally you can use ColumnHeader.Width = -1 (or
-2), but in
/// this application there are several ListView controls that use a
different font for
/// its items and headers. ColumnHeader.Width autosizing appears to
calculate the width
/// for each ListViewSubItem using the ListView.Font instead of the font of
the widest ListView.Item.
/// This method is not thread-safe.
/// </summary>
/// <param name="ch">The column header to be widened. It must have a valid
parent ListView.</param>
/// <param name="subitem">The subitem whose width is to be measured.</param>
private void SetColumnHeaderWidth(ColumnHeader ch, string stringToDisplay,
Font fontOfString)
{
if (null == ch)
{
throw new ArgumentNullException("ch");
}
ListView lv = ch.ListView;
if (null == lv)
{
throw new ArgumentException("The ColumnHeader must have a parent
ListView.", "ch");
}
// This is used for measuring items for the arguments listview
// to make sure the columns are wide enough to see their data.
Graphics g = lv.CreateGraphics();
try
{
int subitemWidth = g.MeasureString(stringToDisplay,
fontOfString).ToSize().Width;
int defaultStringWidth = g.MeasureString(stringToDisplay,
lv.Font).ToSize().Width;
// HACK 10-17-06 SEC: When setting the column header width
programatically,
// it appears to set it just a hair too small for the text you specified.
// I believe that this is related to some hardcoded padding where in
older
// versions of .NET, for example with this bug:
// http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B179988
// "Internally, the Width of a ColumnHeader is padded with some
predetermined
// constant when it is changed programmatically. This padding is not in
effect
// if the Width of the ColumnHeader is changed through the user
interface."
// According to the aforementioned article, these hardcoded values are
// 29 for get and 30 for set.
if (ch.Width < subitemWidth + 29)
{
ch.Width = subitemWidth + 30;
}
}
finally
{
// We *must* manually dispose of the graphics now that we are done with
it,
// per MSDN documentation for Control.CreateGraphics method:
// "The returned Graphics object must be disposed through a call to
// its Dispose method when it is no longer needed."
if (null != g)
{
g.Dispose();
}
}
}
Since I did say that this post is a question, my questions are:
1. Has anyone else encountered these issues and did you find a better way to
resolve them?
2. Are any of these problems known bugs? If so, have they been resolved in
more modern releases of Visual Studio .NET/Visual C# ?
--
Sarah Cartwright Tag: How to change the size of the ErrorProvider hint Tag: 105907
Dataview.Rowfilter help
hey guys
I am tring to implement a filter in a datagrid. I am using a datatable
which is the datasource for the grid.
I need to filter set of rows. i.e. from row 1 to row count. i need to
keep my row 0 intact, which is an option to add a new person.
textbox key up code looks like this:
string strRowFilter = String.Concat("Name LIKE '%", txtName.Text,
"%'");
dv.RowFilter = strRowFilter;
grdNames.DataSource = dv;
plz help
sunny Tag: How to change the size of the ErrorProvider hint Tag: 105905
CheckListBox row color ...
Hi
I have a CheckedListBox and I like to set the color of each row depending on
a value of the specific item in that row. I can't find a DrawItem event like
in the ListBox to hook on to ... Is there a way to achive this? I can get a
rectangle for each specific item (and row). Is there a way to use this?
Cheers.
Richard Tag: How to change the size of the ErrorProvider hint Tag: 105901
custom listview - checkbox problem
seeking a little input on a problem I am seeing -
Background...
I have developed a custom listview object in .NET fx 2.0 - it supports
drag/drop operation, images in subitems, and sorting via specific
datatypes -
to provide the custom sorting functionality, I had to implement custom
column headers and a column collection object for use in the listview
for visual designer support. to support the image in subitems, i
implemented a custom SubItem class..
the listview itself is OwnerDraw, but unless there is a specific need
for owner draw (i.e., the SubItem is an image), I just set
e.DrawDefault = true and let the base class take care of the drawing..
##
the problem I am seeing is when CheckBoxes=true on the ListView... The
checkboxes are rendered, but it appears as though the vertical offset
is not calculated properly (?)... All of the subitems (text) are
rendered in the appropriate position, but the Checkbox is about "1/2 a
row" too high within the ListView, which leads to the BackGround
painting of the next Item to overlap the Checkbox.
I have done a screen dump and checked the spacing, and the vertical
spacing is correct, it's just higher than the rest of the listview
item.
I've tried to reproduce this behaviour using a simple OwnerDraw
listview "test" object, but have yet been unable to emulate the
problem... does anyone have any good ideas of where to start looking
for the problem? I would suspect the column header to be the cause of
the problem, but everything else renders with the proper vertical
positioning.
thanks - Tag: How to change the size of the ErrorProvider hint Tag: 105896
Strange error when app starts
I have a strange (to me) problem with a c# forms application that I am
developing. The application is installed on approxmatly 30 Windows XP
machines and until recently they all worked perfectly. However since I have
updated the application to a new version one of the machines fails with an
unhandled exception when the application starts. The code in program.cs
works fine and anything before the InitializeComponent(); method in the main
form. As soon as the aplication enters the InitializeComponent method it
crashes with mention of a filenotfound exception.
I have copied the application folder from the failing PC to a good PC and it
works fine which leads me to believe that it must be a system file that is
missing. Likewise if I copy the program folder from a good PC to the failing
one it again fails.
I have reinstalled the app and the .Net 2 framework but to no avail.
Having only done "basic debugging" I'm now a bit stuck.
Any help would be appreciated Tag: How to change the size of the ErrorProvider hint Tag: 105895
Single instance help!
Apologies for what must seem a newbie question (but I'm a newbie!)
I'm building an MDI app, and have declared new instances of several child
forms in a module. Then, in the parent form (where the IsMdiContainer
property is set to True) I simply Import the module, and then behind some
button click events I call the child forms with something like;
FrmChild.Show()
I'm doing it this way because I don't want users to create multiple
instances of the same child form.
However, I don't know how to set the mdiparent property of these child forms
when I'm declaring them in a module.
If I declare them in the code of parent form I'd use something like;
Dim MyChild As New Form
MyChild.MdiParent = Me
MyChild.Show()
But this doesn't work when declaring the child forms in a module.
I know there's probably a very simple explanation. Please help! Tag: How to change the size of the ErrorProvider hint Tag: 105894
How to use standard expand/collaps buttons of TreeView
Hi,
I'm building my own tree-like control and would like to use the
standard expand (plus-sign) and collapse (minus-sign) buttons used by
the Windows TreeView control.
How can I do that? Are the standard buttons icons that I can load from
a Windows dll or can I paint similar icons myself, e.g. using the
ButtonRenderer class?
I'm using C# and .NET 2.0.
Thanks in advance
Ulrik Tag: How to change the size of the ErrorProvider hint Tag: 105892
DataGridViewComboBoxColumn
Does anyone know how to set the selecteditem on a
DataGridViewComboBoxColumn?
I am bringing back a result set in the datagridview and need to pick a
specific item from the DataGridViewComboBoxColumn of each row.
Thanks Tag: How to change the size of the ErrorProvider hint Tag: 105886
Creating abirtray forms on UI thread
Hi,
I have a Logging class.
Part of the job of the logging is to create a "tracewindowform", if
required.
It doesnt make sense to pass a reference to the UI thread, since the logging
request might be from a non UI thread.
Is there any way that an arbitrary thread can find a reference to its UI
thread, or parent form, and then ask it to create a tracewindowform on its
behalf?
Shak Tag: How to change the size of the ErrorProvider hint Tag: 105884
How to set a C # form never be focused?
Hello all,
Here comes a C# Form focus controlling question.
I write a C# program that only contains a form and will attach to a
general process when I execute it, (e.g.: Notepad.exe) Now, the C# form
can display successfully without stealing the focus from the Notepad
process, i.e. show-no-activate, by using [DllImport( "user32.dll" ) ]
and call the SetWindowPos as follows:
{{{
SetWindowPos( handle, (IntPtr) HWND_TOPMOST, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW );
form.Visible = true;
}}}
My planned next step is to prevent the C# form from getting the focus
when I click on it. That is, it is hoped that the focus should be
always on the attached application such as Notepad. Does anyone know
how to do that?
James S. Jan
shihyi@iis.sinica.edu.tw Tag: How to change the size of the ErrorProvider hint Tag: 105877
Writing Data In Tabular format in Text File.
Hi guys,
i want to write some data in tabular format in text file. i've data in
strings and i want to write like this in file
col1 col2 col3
d1 d1 d1
d2 d2 d2
d3 d3 d3
the problem is, i dont know how can i maintain spaces between the
columns as i dont know which column will have what length of text.
in c++, i think u can do by adding padding to make sure the alignment
remains correctly but i dont know how can i do that in c#.
i would appriciate your help,
thanks
Lucky Tag: How to change the size of the ErrorProvider hint Tag: 105876
How to store additional information in a DataGridViewComboBoxColumn column?
.NETTers,
My table for customer information contains CustomerName and CustomerID.
In the datagridview, I am using DataGridViewComboBoxColumn to display
the list of customers.
When the user selects a customer, the corresponding cell gets filled
with the name of the customer.
However, in this process, I seem to be losing the customer ID. In my
application, the name of the customer is only for display purposes.
When OK is hit on the main Windows form, I need the actual customer ID.
When the user selects the customer name in the combo box, I somehow
need to retrieve the associated customerID and tag it to the current
data grid row.
This seems like a simple requirement. Is there a simple way to achieve
this?
I am trying to use standard datagrid functionality as much as possible.
Thank you in advance for your help.
Pradeep Tag: How to change the size of the ErrorProvider hint Tag: 105874
How to manully draw a horizontal scroll bar?
In my subclass of ListBox, I set the DrawMode as OwnerDrawFixed. But
this caused my ListBox had no horizontal scroll bar.
How to manually draw it? Something I missed?
Thx in advance. Tag: How to change the size of the ErrorProvider hint Tag: 105873
localization of Microsoft controls
Hi;
The asp:Login control has text in it such as "User Name:". Will that
localize or do I need to do it? And if I need to do it, what is the best way
to do it?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm Tag: How to change the size of the ErrorProvider hint Tag: 105871
Show empty GridView as empty grid
Hi;
Is there a way to show a grid view with no data as a grid - but it just has
a header or a header and 1 empty row?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm Tag: How to change the size of the ErrorProvider hint Tag: 105870
resource in OnClientClick
The following works great:
OnClientClick='<%# Eval("UserName", "return confirm(\"Delete the user
{0}?\");") %>'
But I need to do this with a resource and the following does not work:
OnClientClick='<%# Eval("UserName", "<%$ Resources:Windward, Admin_Confirm
%>") %>'
How can I accomplish this?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm Tag: How to change the size of the ErrorProvider hint Tag: 105869
Std Out from Windows Forms
I have read many questions and responses to this question, but before I give
up and switch to a console application, I wanted to see if there was a way to
reset Console.Out to be the console IFF the user executed the app from a
console window already. I would detect this by the existence of command line
parameters.
Is there a text writer or listener that I could created to get the output to
the console it was launched from?
Thanks, Tag: How to change the size of the ErrorProvider hint Tag: 105868
<title> <%$resource%> </title>
How do I put a resource in the title? I have the rest of my page localized
but the title remains in English.
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
Cubicle Wars - http://www.windwardreports.com/film.htm Tag: How to change the size of the ErrorProvider hint Tag: 105867
window form based application for different DPI settings
I have developed a window form based application for tablet pcs. The problem
I am facing is screen looks displaced on high dpi setting ie 120 how it make
it work for both resolution
Thanks
Sudhee Tag: How to change the size of the ErrorProvider hint Tag: 105866
Verify a windows username?
I have an vb20005 app where the admin can add a user to the local User table.
I only want valid NT Users to be added to this table. At this point in time
I have the user typing it in becuase I didn't see any sort of active
directory dialog box.
In my dataGridView cell validating function I want to verify that the string
typed in is a valid user, is there somehting that can do this for me? I've
looked around the windowsidentity class and couldn't find anything... any
ideas?
FYI: I would love some sort of active directlry dialog box that is plug and
play that I don't know about which would erase the need for this verification.
thanks, Tag: How to change the size of the ErrorProvider hint Tag: 105864
ClickOnce updates and Local Data Files
Hello,
I have a ClickOnce application that is set to check for updates on
startup and has a small settings file that includes some user-specific
information collected from a form that I want to persist across
application updates. The first time that the application is updated a
new directory is created, but the contents of the directory from the
previous version are not copied. For all proximate updates, the
contents of the new directories are copied as expected.
The path I am creating to save the files I need to be copied is from
the variable ApplicationDeployment.CurrentDeployment.DataDirectory. The
manifest I am using is generated by Visual Studio.
This is essentially the same problem as posed in the following post:
http://groups.google.com/group/microsoft.public.dotnet.framework.windowsforms/browse_thread/thread/60ffb8264f7b0101/11c57e45fd5af983?lnk=st&q=clickonce+updates+user+data&rnum=2&hl=en#11c57e45fd5af983
What are the potential causes of this behavior?
Thanks! Tag: How to change the size of the ErrorProvider hint Tag: 105862
LocalReport - Hangs when calling GetDataSourceNames()
Hi,
We are developing an application where we are using the LocalReport object
as our server-side report rendering solution. All has gone well so far, but
we have started hitting an issue with the LocalReport object.
After we instantiate the LocalReport control, the first thing we do is point
it to the RDLC file on the file system, then we call the GetDataSourceNames
method to retrieve an IList of string objects. For some reason, execution
almost always hangs on that call. I say "almost always" because it takes a
random number of executions to get to that point. Sometimes the first time
we render a report on the server it fails. Other times, I can get it to run
two times, and the third time it hangs.
This issue only occurs in Win2k3 machines. When run on XP SP2, it goes
through just fine. All our dev machines are XP, so we developed our engine
with no problem....then finally deployed out to Win2k3 server and started
getting this.
Our application is hosted in IIS and the objects are COM+ objects. We use
.net remoting to call IIS.
The code is as follows:
Imports ctrl = Microsoft.Reporting.WinForms
...
Private m_lclReport As ctrl.LocalReport
...
Public Function RenderReport(ByVal reportFormat As String, _
ByVal reportDefinition As
Biz.ReportDefinition) As Byte()
Dim _list As IList(Of String)
Try
m_lclReport = New ctrl.LocalReport
'set the Path
m_lclReport.ReportPath = reportDefinition.Path &
reportDefinition.Name
_list = m_lclReport.GetDataSourceNames()
...
Execution freezes when it runs that last line. I've let it go for 1 hour+
and it never frees up and never thrown an exception.
I've run it on multiple RDLC files, and the issue still occurs. I've tried
it with reports w/ sub reports, and those without....same result.
I've looked out there for known issues regarding LocalReport object freezing
up...but have not found any.
Anybody else out there have encountered this issue or anything similar?
Thanks,
Rob Tag: How to change the size of the ErrorProvider hint Tag: 105861
How to limit the size of a form based on a contained control
Currently this code has to work in .Net 1.1
I have a form. I has a control (based on Panel) that occupies a large portion of the form. The control is anchored on all 4
sides. It is not docked on any side. The panel control resizes and repositions its contents based on its size.
There is a minimum useful size for the panel control. I would like to limit the minimum size of the form based on the panel
reaching its minimum size.
My first thought is to set the minimum size of the form to the size of the panel plus its distance from the edges of the form.
This would work for the simple case, but if the panel is placed inside another container control that is on the form then things
get more messy.
Is there a better way?
Thanks
-------------------------------------------
Roy Chastain
KMSYS Worldwide, Inc.
http://www.kmsys.com Tag: How to change the size of the ErrorProvider hint Tag: 105858
VS.NET 2006 Project Build Error
Hi,
In my C# projects I get the following error.
Unable to copy file "obj\debug\test.exe to bin\debug\test.exe" Access to
path "bin\debug\test.exe" is denied.
I have binded the project to VSS 2006.
Any thoughts
Thanks, Tag: How to change the size of the ErrorProvider hint Tag: 105855
VS.NET 2006 Project Build Error
Hi,
In my C# projects I get the following error.
Unable to copy file "obj\debug\test.exe to bin\debug\test.exe" Access to
path "bin\debug\test.exe" is denied.
I have binded the project to VSS 2006.
Any thoughts
Thanks, Tag: How to change the size of the ErrorProvider hint Tag: 105854
VS.NET 2006 Project Build Error
Hi,
In my C# projects I get the following error.
Unable to copy file "obj\debug\test.exe to bin\debug\test.exe" Access to
path "bin\debug\test.exe" is denied.
I have binded the project to VSS 2006.
Any thoughts
Thanks, Tag: How to change the size of the ErrorProvider hint Tag: 105853
VS.NET 2006 Project Build Error
Hi,
In my C# projects I get the following error.
Unable to copy file "obj\debug\test.exe to bin\debug\test.exe" Access to
path "bin\debug\test.exe" is denied.
I have binded the project to VSS 2006.
Any thoughts
Thanks, Tag: How to change the size of the ErrorProvider hint Tag: 105852
How to get a valid Image
At startup my application loads an image from a file from disk. If the file
is not there, I still need a valid System.Drawing.Image object but I don't
know how to get one.
//class MyImage
class MyImage
{
//data member image
System.Drawing.Image image;
//constructor
public Image():this(@"c:\Some Directory\Some Image.jpg"){}
public Image(string a)
{
try
{
image=System.Drawing.Image.FromFile(a);
}
catch
{
image=...
}
}
} Tag: How to change the size of the ErrorProvider hint Tag: 105850
Datagrid inside a Panel doesn't load records
hi all,
I'm using .NET Framework 2.0 and I've created a Panel with a DataGrid
inside.
This datagrid was created automatically by dragging & dropping into it
a datasource.
The problem is that if I put this panel into a Form I can't load any
data from my db.
If I drag & drop into this same Form the same datasource of the panel
all datas are loaded correctly.
why ?
Thax at all Tag: How to change the size of the ErrorProvider hint Tag: 105845
Filtered/sorted Datagrid
Hey Guys
Alot of articles and alot of stuff still no answer. Please help me on
this one. I need to get data out of a filterred selected row !!! ...
this is how my code looks like....
On load:
dv = SearchData.DefaultView;
if (SearchData.Rows.Count >= 1)
{
grd.DataSource = dv;
}
I have datagrid which is filtered on keyup in a text box :
string strRowFilter = String.Concat("FirstName LIKE '%", actual, "%'",
"OR LastName LIKE '%" , actual, "%'");
dv.RowFilter = strRowFilter;
grd.DataSource = dv;
Then i need to get from the filtered ron in the datagrid. I am using
currentcell changed
DataGridCell tCell;
tCell = grd.CurrentCell;
grd.Select(tCell.RowNumber);
MessageBox.Show(grd.CurrentRowIndex.ToString());
MessageBox.Show(dv.Table.Rows[tCell.RowNumber][0].ToString());
I need to get ID of this row from my column.
I know i am doing sumthing wrong... plzzzzzz help
Please help!!!
sunny Tag: How to change the size of the ErrorProvider hint Tag: 105844
Use of Form.Owner property without the the owned forms always on
Hello again!
I haven't had any replies on my previous post about this issue, and I'm
getting a bit anxious that this isn't technical possible to solve.
I have tried to search for information on the net last week, without any
luck. I've also tried to solve this matter with use of different windows
API functions, but to no use. So I'm really hoping that someone can help
me with this as soon as possible.
The text in the original post was as follow:
"I have a form (Form1) which works as the "main menu" from where I open
many other forms (Form2, Form3 and so on).
In order to make the "Sub Forms" (Form2 and Form3) minimize and close
with the parent form (Form1), I use Form1 as Owner for the other forms
(e.g Form2.Owner = Form1).
As the documentation says, Owned forms are never displayed behind their
owner form. But this is my problem. When a owned form (Form2) is partly
dragged onto its owner (Form1), and I click to focus Form1, it is
activated,but still behind Form2 (as expected).
What I want is to have the forms behave just as if i didn't set the
Owner property, but still with the "binding" where owned forms will
close and minimize with the Owner. I'm also dependent on beeing able to
loop through all the owned forms something like this:
For Each ownedForm As Form In Me.OwnedForms
...
Next
So as you can see, I want all the benefits of use the Owner property on
a sub form, but I do not want the Owner to always be behind its owned
forms. Is there some way to acheive this? "
Once again thanks for any help!
Regards
Øyvind Liland Tag: How to change the size of the ErrorProvider hint Tag: 105838
Databinding and Bindingsource issue
Hi
I have a form with master data and child records.
Master data is taken care of by couple of textboxes and a
datetimepicker and are bound to a bindingsource. For textboxes I have
added bindings for Text and for datatimepicker it is for Value.
Childrecords appear in a datagridview.
When I change data in master records it does not switch on the
dataset.haschanges switch while the child records are.
Do i have to take any extra step to enble this.
thanks
Newish Tag: How to change the size of the ErrorProvider hint Tag: 105835
Bug: Windows Form + MainMenu ALWAYS produce wrong form Height
Hello all,
Finally I have decided to write about a bug in the winforms engine
that has been nagging me since the early days of the NET 1.0 betas. It
showed up in the final NET 1.0 release, in the service packs, in NET
1.1 and its service packs. And unbelievably but true it's still there
in NET 2.0, CLEARLY visible for everyone who wants to see it.
If a Windows Form contains a MainMenu then the Height of the first
instance of the form will be 1 pixel short, while the next instances
will all have an excess height of 18 pixels. The difference, 19
pixels, is related to the standard height of a menu bar.
The bug exists even in NET 2.0 when you drag a MainMenu to the form.
This happens in Windows 2000, Windows XP and Windows 2003.
The new MenuStrip of NET 2.0 does NOT contain the bug.
Let's reproduce the problem:
1. Create a new windows project with one form. Name the form class
FormSize. Add a using System.Diagnostics; line.
2. In the property box, give the form the following properties:
Location = 80,80
Size = 200,200
Startposition = Manual
3. Drag a MainMenu to the form. Create an item File on the menu and a
subitem OpenForm.
4. Doubleclick on OpenForm and enter the following code:
FormSize frm = new FormSize();
frm.Location = new Point(this.Left + this.Width, this.Top);
frm.Show();
5. In the Form_Load and Form_Activate events enter the following code:
Debug.WriteLine("Form: Height=" + this.Height + ", Width=" +
this.Width);
6. Compile and run the program with F5.
You will discover that your form has a Width = 200 and a Height = 199.
So one pixel short.
Now click on you menuitem OpenForm. A second instance of your form
will appear next to the first one. This second form has a Width = 200
and a height = 218. So 19 pixels HIGHER than the first form. The
standard menu bar has a height of 19 pixels and that accounts for the
difference.
Easiest workaround:
add the following statement to Form_Load:
this.Size = new Size(200, 200);
If you look at the generated code you will discover that the Size
property in the property box is a so-called shadow property: from its
value a ClientSize value will be calculated and this appears in the
generated code. To complicate matters further the form DOES have a
Size property, but this one is unrelated to the pseudo-Size property
in the property box.
I have no problem with the forms engine calculating a ClientSize from
my property box pseudo-Size property. I have problems with the outcome
of the calculation being wrong in runtime.
THIS BUG IS NOT AT ALL 'ELUSIVE'. In fact it is glaring, VERY visible
and VERY easy to reproduce.
However, you will find NO MENTION AT ALL of this glaring bug in the
Microsoft knowledge base. If you speak to Microsoft officials (I work
for a Microsoft Gold Partner in Holland and we have regular contacts
with Microsoft representatives) they invariably have NEVER heard of
this glaring bug. You won't find it on the internet, except perhaps in
some elusive posting of years ago.
I cannot understand that this bug has been going unnoticed for so many
years.
It seems that nobody in the world has ever used a dotnet Windows Form
application with a menu bar at the top in a real world application.
Otherwise surely people SHOULD have noticed that ALL their forms are
at least one pixel off. Yes sir, ALL your forms with a MainMenu are at
least one pixel off.
I hope that this time SOMEONE at Microsoft takes notice of this
problem, tries to reproduce it and tries to explain to me how on earth
such a visible bug has gone unnoticed for so many years. Do they
really TEST their software in America?
In Holland we programmers have the following saying for American
software: "It compiles, so it's ready. Let's sell it"
I also hope that you understand first THAT I am very annoyed and
second WHY I am very annoyed and irritated.
You see, what will happen if you show this bug to managers of, say,
big financial companies & banks and tell them that the next version of
their critical software will be using this framework. Ah, we were
three digits off in the bank account number, so the deposit went to
the wrong customer, but who cares?
How trustworthy is the software if even such visible bugs go
unnoticed? How about the bugs that are NOT so easy to notice?
Ernesto.
"You don't have to learn science if you don't feel
like it. So you can forget the whole business if
it is too much mental strain, which it usually is."
Richard Feynman Tag: How to change the size of the ErrorProvider hint Tag: 105833
Looking for the best features, easy to use Grid Component
Hi,
Could anyone point me to a website which showing the current top 10 grid
components or a featuring comparision?
Thanks
--
DHD Tag: How to change the size of the ErrorProvider hint Tag: 105830
TreeView is displaying two root Nodes
I have a treeview that is displaying two root nodes..
Can someone give me a pointer on what this might be?
I have created a componet and i inherit form system.windows.forms.treeview
There are no errors and all starts fine; however i am seeing double.. :)
help! please!
here is my test project
http://www.constructionsupercenter.com/SoftWare/Help/Visual%20Studio%202005/Windows/TreeView/SuperBrowser.zip
......
thanks
erik
EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com Tag: How to change the size of the ErrorProvider hint Tag: 105827
MenuStrip
I'm using MenuStrip and C#.
I want to close menustrip (items and subitems) when menustrip lose focus.
Now, MenuStrip is open until I click on another control on form. This is no
good for me.
I want to close menu strip when it lose mouse focus without furher click on
form.
How to do that?
charlie Tag: How to change the size of the ErrorProvider hint Tag: 105826
PrintPreviewDialog
Using .net 1.1 (VS2003), if I turn on visual styles,
PrintPreviewDialogs will show without pictures for any of the toolbar
buttons. How do I make it work, without making my own
PrintPreviewDialog? Tag: How to change the size of the ErrorProvider hint Tag: 105825
Show vs ShowDialog
Hi,
I know that htis has been asked many times, but I've had a look and none of
the existing discussions seem to answer my question.
I want to launch a non modal dialog along side my main app that will output
trace data - so a textbox control on it will be added to quite a lot. Which
method of the following is best for this, and why?
//Flashes then disappears. Why?
Thread thread1 = new Thread(delegate(){new Form().Show();});
//Form has own UI thread, and doesnt block parent.
Thread thread2 = new Thread(delegate(){Application.Run(new Form())});
//Uses parent's UI thread, but doesnt seem to block parent either.
Thread thread3 = new Thread(delegate(){new Form().ShowDialog();});
I'm using anonymous delegates here just for berevity, but assume that I have
handles to the created forms.
Thanks!
Shak Tag: How to change the size of the ErrorProvider hint Tag: 105824
listbox event lost
I have a form with a DeptList, an EmployeeList and a panel containing a bunch
of textboxes for employee data, e.g. name, address, etc. The textboxes are
bound to a datatable in a dataset. The DeptList SelectedIndexChanged event
handler is used to populate the employeeList and its SelectedIndexChanged
event handler is used to populate the textboxes. I also have added a handler
for the DataColumnChanged event of the datatable
Private sub OnColChanged(..)
m_bDirty = true
end sub
and a handler for the panel validating event
private sub DataPanel_Validating(..)
if m_bDirty then
QuerySave ( this uses a msgbox to query the user)
end if
end sub
I now select an employee, enter some data in the text boxes and then click
an unselectd row in the DeptList. With the code in the validating handler
commented out, the DeptList SelectedIndexChanged event is raised and
everything works as expected. With the code include however, the DeptList
SelectedIndexChanged event either wasn't raised in the first place or was
surpressed because the event handler is not called. In fact even with the
code commented out, if I place a debup break point on the End Sub, the
SelectedIndexChanged is not called. Of course since the SelectedIndexChanged
is not called, nothing works correctly. The problem seems to be related to
the listbox because if I click a btn outside the panel everything works as
expected. The list box shows the correct line selected in either case. The
same behavior occurs if I put a breakpoint on the end sub of the OnColChanged
event handler, so that if I change some data and then click the list box, the
execution breaks in the OnColChanged handler and afterwards the
SelectedIndexChanged is not called. How do I get around this problem? Is
there some way to re-raise the pending events for the listbox?
--
JB Tag: How to change the size of the ErrorProvider hint Tag: 105822
ControlDesigner for custom win control
Hello,
I am making a custom win control which places some restrictions on the
value of Text property of the control.
While debugging i noticed that when the control is drag-dropped on a
form during Design Time, the InitializeNewComponent method of the
ControlDesigner is invoked. After this the text property of my control
is set to the control name, which Visual Studio automatically assigns(
name of the control object like textBox1 ...).
Now if I want a default blank value in the control's text property i
can set my own designer, override the InitializeNewComponent method and
set the text value after i call the base InitializeNewComponent method
public override void InitializeNewComponent(IDictionary defaultValues)
{
base.InitializeNewComponent(defaultValues);
//over here text property is smthing like MyControl1 or
MyControl2
MyControl control1 =this.Component as MyControl ;
control1.Text = "";
}
My question is why is this happening ?? Why is the text property of my
control
is set to the control name ? And how to supress this?
Even in Microsofts controls like TextBox when I drag the control on the
form during designtime the text property is set to the control's
instance name and then immediately(within milli seconds) cleared.
Thanks and Regards,
Mohit Tag: How to change the size of the ErrorProvider hint Tag: 105820
Display area in panel
Hi all, I'm trying to create a panel (call it Panel X) that contains
three other panels (call them Panel A, B, and C). Panel A will be
docked to top. Panel B will be docked to left and Panel C will have
its dock set to fill. This is working. However, now I'd like to have
Panel X provide the vertical scroll for the panels and have Panel C
only provide a horizontal scroll if it has contents that go off screen
(in width).
The arrangement looks something like this:
--------------------------------
| Panel A |
--------------------------------
| | |
|Panel B | Panel C |
--------------------------------
I have this working - that is Panel C ONLY providing a horizontal
scroll if it needs it and Panel X (contains all the panels) providing a
vertical scroll ONLY if it is needed.
However, I only have the above working statically. That is prebuilt.
But, when the user is resizing things and moving things around in the
above panels I need to always reset the AutoScrollMinSize based on
those changes. Is there a way of determining the "viewable" area in a
panel? For instance if Panel C gets a bunch of controls off to the
right and below it's viewable area how can I determine the dimensions
of the panel based on what the user can see?
Novice Tag: How to change the size of the ErrorProvider hint Tag: 105819
Was Drawing.Icon.ExtractAssociatedIcon - wrong sized icon
Hi
Sorry about cross-posting, I posted this a couple of days ago on
"microsoft.public.dotnet.languages.vb" and got no response...
(using VS .NET 2005 on Windows XP...)
I have a treeview which shows a mixture of records and files, what I'd like
is for the files to look exactly as they would in Explorer....
I'm using Drawing.Icon.ExtractAssociatedIcon to extract the icon from a
filepath etc. to be added to an imagelist used by a treeview.
Everything works fine but the treeview icon appears to be 32x32 squashed to
16x16 instead of the proper 16x16 icon which looks much better. Using
Drawing.Icon.ExtractAssociatedIcon to get icons (16x16) for list or
treeviews looks awfull, I am guessing that what I'm getting is 32x32
squashed into 16x16.
Anyone know a solution?
Cheers
Mark Tag: How to change the size of the ErrorProvider hint Tag: 105815
Hi.
Is it possible to change the size of the ErrorProvider tool tip?
Some of my text messages are to long.