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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting Tag: 82133
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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting 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: Datagrid sorting Tag: 82114
Tabbing Into a Custom DatagridColumnStyle At ColIndex(0)
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 Tag: Datagrid sorting Tag: 82113
How do you get a 2 day response from Microsoft
I posted a question on "MDI Client Problem" on 12/22/04 and I'm still waiting
for a response.
--
tsiGeorge Tag: Datagrid sorting Tag: 82108
Resource Files
Hi All - Happy Holidays
I'm struggling to understand how to make resource files work in a
multi-lingual vb.net windows app - and feel real stupid.
I've read MCSD books and Visual Studio Help articles, but just don't get it.
Duh.
The ResourceManager class and resource files within a project should be able
to communicate.
Any help or reference to examples greatly appreciated
Regards,
SC Tag: Datagrid sorting Tag: 82104
Resizing a form by client height/width
Hi,
I just wonder if anyone can help me with this:
I need to be able to resize a form by setting the size of its client area.
Say, in Delphi i would do so:
Form1.ClientHeight = 10;
Form1.ClientWidth = 20;
And the form will adjust its size so that client area will be as set.
In .NET Form class there is a ClientRectangle property but it's
read-only and trying to change any of it's properties causes a compile
error:
//-----------------------------------------
Form1.cs(78): Cannot modify the return value of
'System.Windows.Forms.Control.ClientRectangle' because it is not a variable
//-----------------------------------------
Any ideas?
Thank you,
Andrey Tag: Datagrid sorting Tag: 82100
WindowEnumerator
My application has regular document windows and floating windows above
them. I want to iterate through all windows in z-order. I would have
thought this capability would be built-in to the .net framework, but
everything I can find on the archives says no - you need to use
GetWindow(), thus:
[DllImport("user32", EntryPoint="GetWindow")]
private static extern int GetWindow(int hwnd, int wFlag);
And the most logical thing seems to me to be to create a class that
implements the IEnumerator interface. I suspect I need an additional
external function - maybe GetTopWindow? to get a starting point; call
that in .Reset() and GetWindow() in .MoveNext(). Am I on the right
track? Can anyone provide examples of how to call these functions, eg
what arguments to pass to them, how to coerce their result types into
System.Windows.Forms, how to tell when I've reached the end? Thanks in
advance.
Peace,
--Carl Tag: Datagrid sorting Tag: 82096
Updating a windows forms control from a thread
I've gotten this question a couple of times in interviews and I don't know
what they are looking for:
How do you update a control's property, such as a textbox.text property,
from a thread, in .NET? It seems to me you just update it normally. What
are the interviewers looking for here? Thanks.
- W Tag: Datagrid sorting Tag: 82091
Window Not Responding when running external programs
I have a windows form application (C#) that launches multiple external batch
files to do various installation tasks. I want to show some status on the
win form, say simply update the text on a Lable control, "task 1
starting...", "Task 1 completed.", etc.
However, the text for the label is not being updated/showed. I understand
that the window is not responding to the Paint event anymore, How do I work
around this?
I see programs like InstallShield can do this, how did they do it? Tag: Datagrid sorting Tag: 82088
updating forms?
my program draws a form and when you click the start button another form is
drawn with a progress bar as it runs through a function. my issue is that
when you click on another progrem then try to go back to the progress bar
form it doesn't redraw itself. i tried using a:
if(num%100==0)
this.Update();
where num is just to count each time it runs through the loop. the program
still works and finishes, but i can't seem to get the progress bar form to
redraw itself. the this.Refresh() and Update() did not work either. any
suggestions?
btw...it's for an installer, so as it's uploading the database the progress
bar goes, all of it works fine, just need the form to redraw itself if it
loses focus. Tag: Datagrid sorting Tag: 82086
Corrupt resx with inherited forms
Hi
I have a bunch of corrupted resx files. My Cs files are okay. The code
stil compiles and I can still show the forms. They still work, but I cannot
edit them anymore. When I try to edit, the editor is convinced it are plain
cs files and not forms.
How can I recreate the whole design thing? VisStud 2003
kind regards
Alexander Tag: Datagrid sorting Tag: 82080
Application Data
Where do people put application data that is not user specific? For
example, what if I have a xml file containing r/w data for a forms
application, and the application may be used by users with limited rights.
I cannot do any user management, and there is no reason to expose the user
to the fact that these files even exist.
Documents and Settings\All Users\Application Data\... is out because it is
not available to restricted users.
Application directory is out for the same reason.
LOCAL_MACHINE hive in registry is out for the same reason.
Confuzed Tag: Datagrid sorting Tag: 82079
How to draw image on form's title bar?
Hi ..
I wanted to repace form's default title bar with new One.
So Can I draw Image on title bar.
Pleae help
Amar Tag: Datagrid sorting Tag: 82075
Validation problem
I have a form that contains a TabControl. A tabpage on the control contains
a TextBox that is bound to a field in a DataTable. The textbox is readonly.
When the user clicks an Edit button, the field becomes editable. The user
then has the choice of clicking the Cancel button, to discard any changes,
or Update to finish the editing mode. Because the field cannot be NULL, when
the user clicks Update the field should be validated.
The textbox and the update button both have CausesValidation set to True,
while the cancel button does not. For some reason however, the Validating
event gets called when the user clicks the cancel button! Tag: Datagrid sorting Tag: 82073
Panel
Hello,
I have a panel on a form that holds a large number of controls. When I
scroll the panel down and leave the form and then come back, the panel is
still in the last position I left it. Is there a way to make the panel go
back to the top position.
I have tried the following with no success.
Dim APoint as Point
APoint = New Point(0, 0)
frm1Main.Panel1.AutoScrollPosition = APoint
Any Suggestions will be greatly appreciated,
Chuck Tag: Datagrid sorting Tag: 82072
Question re Migration of VB6 App to .NET
Our company develops and markets a client/server application which is
written in VB6 as a rich Win32 Client/Server application. For a variety of
technological reasons we are looking to migrate toward the .NET environment.
However, a number of business factors make it impractical to accomplish this
through an abrupt termination of the VB6 product and complete rewrite.
Instead, we are looking to perform new development in .NET and slowly over
time migrate existing code to .NET.
At this time, we are looking to add a brand new module to our product.
Obviously, the new module has some connection to the rest of the application
in general. Be that as it may, it is sufficiently encapsulated unto itself
that we are contemplating developing this new module in .NET. I'm interested
in any advice which you can offer about how we might 'plug in' a module
written in .NET into our VB6 application, specifically at the UI layer. We
must provide the user with a seamless UI interface to our application,
regardless of whether the user is interacting with a VB6 Form or with a .NET
WinForm.
Thanks very much for any advice which you can provide.
- Joe Geretz - Tag: Datagrid sorting Tag: 82071
Huge Memory Usage
Hello all,
I am writing an application in C#, VB.NET which basicaly
has a form with a few pictureBoxes on it and a TabControl
with 3 tab pages - in each one a treeView and a ListView.
In addition it loads a few other dll's as a reference
which should not be memory consuming since each have a
few simple classes.
The thing is - this application can take up to 40,000KB
of memory!!!
Any idea where to start checking? How can I debug and see
what part of my application is responsible for such
memory usage?
One more thing: I did some tests and noticed that even a
simple form with nothing on it can take up to 15,000KB ,
am I doing something wrong???
Thanks,
Haim. Tag: Datagrid sorting Tag: 82069
Problem with time in access
HI
In Access the date is like
21/12/2004 08:57:17 a.m.
I need to update the record only if it was not created more than five
minutes ago
cmd = "UPDATE Sales SET Status = 'A' WHERE Mid(SalesDate,13,20) > #" &
Mid(Microsoft.VisualBasic.DateAdd(DateInterval.Minute, -5,
DateTime.Parse(DateTime.Now.ToShortTimeString, myFormat)), 13, 20) & "#"
e.g
When the time is 2:07:00 p.m.
I can see the query goes to ADO like this
"UPDATE Sales SET Status = 'B' WHERE Mid(SalesDate,13,20) > #2:02:00 p.m.#"
but there is a syntax error, any idea
thks Tag: Datagrid sorting Tag: 82066
Load event in user control
Hi Gurus.
I'm doing my first steps in the Winforms realm (I dealt mainly with
ASP.NET until now), and I've stumbled across issue I really cannot
solve and that seems extremely stupid to even ask about, so please
forgive me...
I need to execute some logic in the Load event of the control. Problem
is - I can't find that event for user controls! This logic cannot be
executed in the control's constructor, because its properties are not
set yet. I don't want to modify the InitializeComponent method code, as
I understand it is strongly un-recommened.
In ASP.NET, there is a Load event for every control, which enables me
to do just that. What is its equivalent in Winforms controls?
Thanks! Tag: Datagrid sorting Tag: 82062
OnStartTask in UIP v 2.0
Hi,
I'm using UIPAB v 2.0 in a Windows application. Following the UIP
documentation I'm trying to "nest" two tasks. As I need to pass data between
those two tasks, I;m using the OnStartTask method. This is what the
documentation say about nesting tasks, using that method:
"When the Add New Shipping Address process is ready to return, retrieve the
TaskId for the Purchase Product process, which is stored in the current
task's state, and invoke the OnStartTask method, passing the name of the
navigator, the new address, and the original TaskId. If the task state for
the specified task is found, the current view for that task is displayed."
The problem is that the OnStartTask method requires an Itask implementation
as its third argument and not plainly the TaskId. Should I implement the
ITask just for the sake of resuming a suspended task?
Thanks,
Gwenda Tag: Datagrid sorting Tag: 82061
Adding Expand functionality to menus
Hi, I'm trying to make an office-like expand menu, kind of like windows
personalized menus. Right now, I've made my own custom menuItem, but the
problem is when you click it, it will automatically close the menu interface.
Is there a way to avoid this? Tag: Datagrid sorting Tag: 82059
set the listview highlight one line
hello
how can i set up the listview to high-light one line that is selected by
mouse.now only the first column can be selectable.
thank you. Tag: Datagrid sorting Tag: 82055
Is it possible to sort datagrid from code and how?