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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... 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: WinForms question... Tag: 82055
inherited forms
Hi
I seem to have a lot of problems with inherited forms in VS2003.
Problem 1:
Form1 has a txtEdit1. Form2 inheriteds from form1. But for some reason I
would like to be able to access form1.txtEdit. When I put his modifier to
protected instead of the default private. The control just disappears. IT
IS GONE. (as in not longer their or very much away).
Problem2:
Form1 has a panel docked to the bottom, and a central panel docked to fill.
Form2 needs a panel docked to top. For some sick reason this Form2.PanelTop
always overlaps the central panel. It doesn't move the central panel down,
making my first edit box INVISIBLE (as in not longer able to see it.)
Anybody can confirm these issues? Please tell me that I'm doing something
wrong here. Otherwise I have to assume that form inheritence doesn't work
in C# VS2003.
Kind regards
Alexander Tag: WinForms question... Tag: 82053
Animated GIF
Hi All,
I want to show animated GIF on form. I used ImageAnimator class to
Animate and StopAnimate method to stop the animation. But my client says
that if he stops the animation in between then it should not stop at that
postion, but it should complete its remaining rotation and then stop.
e.g. if image starts rotating from its default postion and it goes till half
cycle, at that moment if user stops it then it should complete the remaining
half rotation and then stop.
I am developing windows application using C#.
Can anybody guide me regarding this problem.
TIA
Jaydeep Tag: WinForms question... Tag: 82052
Pass Values from .NET Windows App to Open IE Form
I need to pass several values from a .NET Windows app into an EXISTING, OPEN
IE form.
I found the following code snipped for VB6 elsewhere on the forums--it's
close:
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "http://www.kbb.com"
Do Until IE.readyState = 4
DoEvents
Loop
IE.Document.emailsignup.email.Value = "MYEMAIL"
But...
* I need to do with a .NET Windows app, not VB6
* The IE window will already be open (the user must sign on and display it
first--code cann't do that)
* Once items on the IE form have been filled, the IE Window needs to be
brought in focus so the user can fill in other form elements before
submitting.
Ideas?
THANKS! Tag: WinForms question... Tag: 82050
Help on design decision with Tree structure data
I have some data organized in a tree structure saved in an XML file
and I want to display it in a TreeView control (the XtraTreeview of
DevExpress).
Each data item I would like to store in a class so that I can attach
to it some logic (for example to each data is associated an Execute
method).
I wonder what is the best solution: subclass the TreeView Node and
extend it adding all the logic I need or create a completely detached
tree structure that contains my data and then link it somehow to the
TreeNode component (probably this way is nicer since I don't match and
mix business logic with the interface).
One thing to notice is that the data will change (the user can modify
it) so I'll have to take care of updating the data structure.
Thanks a lot for any suggestion.
Andrea Tag: WinForms question... Tag: 82048
Docking Toolbars
In Windows Forms I have a main Toolbar and I also have a control that
contains a toolbar. Is there a way of docking the control's toolbar besides
the main toolbar? Or just docking the control's toolbar in the main Window's
form (not just docking it within the control but outside of it in the main
form)?
Thanks in advance,
Tom. Tag: WinForms question... Tag: 82047
datagrid wrapped textbox column
Hi,
I have a database table with long text fields. I use datagrid to display the
data. For long text fields I build custom column which inherits from
DataGridTextBoxColumn so I can wrap text in the datagrid cell. Custom
TextBoxColumn is able to determine the column height. I overrided
GetMinimumHeight and Paint methods. To edit row data I launch dialog window.
My problem is : when I finished with dialog window text fields will be
changed and I want datagrid/my custom column recalculate the height. But
datagrid doesn't ask my custom column to do this (call GetMinimumHeight on
custom column). Unless I manually resort datagrid - click on column header.
Is there any solution to force datagrid to call GetMinimumHeight in custom
column
Thanks,
Rynad Tag: WinForms question... Tag: 82045
Improving Performance
I have a table called tblOrg in a SQL Server 2000 database.
It has PK = Org_ID and a field called ParentOrg_ID so an Organization can
have 0, 1 or many children but only one parent.
I have a recursive function that builds a tree view of this and populates a
tree control with Org_ID as the key and OrgName as the Text. Everything
works great and performance is great as long as the data base and the
application are on the same machine. But performance is unacceptable on a
remote machine connected via a LAN.
This is to be expected because the application is using sqlcommands to build
the tree in the recursive function. Thus, the same sqlcommand is executed
once for each organization.
Obviously to get the most update version of the data you have build it from
the database. But what other ways are there, that once built, one can reuse
it rather that rebuild the tree?
For example, the user selects OrgType from a dropdown (College, High School,
Middle School) which populates the tree control with organization of that
type, he then can select the Organization and populate the form with the
details of the selected organization.
When changing the OrgType, the control is completely rebuilt via the
recurisive function which goes to the database. Instead, it would be nice to
persist the previously clicked OrgTypes in memory so that the tree control is
populated from memory if that OrgType is reselected.
Since this tree control is used in other places in the application, it might
be better to populate a dataset in memory so that all projects within the
application can reference and populate the tree control that way or, better
yet, all instances of the application can use it. For example, a user A
opens his application which causes the Tree to be built. But user B opens
his application but the application has access to the already populated tree
because of User Aâ??s work (This organization structure does not change often).
How can I do this? Any VB or C# code examples would be nice?
WR Tag: WinForms question... Tag: 82044
IPC
Hi,
Is there a simple way of getting the text of a TextBox from one
application, to another, on the same machine ? Tag: WinForms question... Tag: 82043
Merging Toolbars
Hi,
I have my main Windows Forms Application and a control that contains a
context menu and a toolbar. Now I was able to merge the control's context
menu with the application's main menu no problem by using the MergeMenu
functions. I cannot find anything similar for merging toolbars. Is there a
way for merging toolbars so that the control's buttons will be incorporated
into the main application's toolbar and yet their functionality will be
accessed from the control (just like when the menus are merged)?
Thanks for your help in advance,
Tom. Tag: WinForms question... Tag: 82040
How to generate Dynamic UI (similar to an HTML page) in wondows application
Hi,
I am developing an application which is similar to any pricing
application (such as on Dell site where you customize your computer and
get the price).
The difference is -its not web application. Its Windows application.
How can I dynamically generate UI Page from Database settings.
The options will be radio controls or check boxes - enabled or not
enabled - etc. The text associated with control may vary. Based on
number of controls - it may vary the
If some body have data model for this pricing application - could you
please post it.
Mallikarjun Tag: WinForms question... Tag: 82039
Xp style Title Bar
Hi
I wanted to replace my form title bar with xp style looking title bar.
I am desgning applocation which will run on window 2000.
Please help me how should i do that..
thanx.. Tag: WinForms question... Tag: 82038
Hide TabPages
Hi
I have made a custom TabControl and a Custom TabPage to go with it.
The custom TabControl has a collection of custom Tabpages, which shows in
the property editor.
What I need to do now, is to hide the TabPages property inherited from
TabControl. I whant the developer to only use my collection.
Is this possible?
TIA
spif2001 Tag: WinForms question... Tag: 82036
Xp style title bar
Hi
I wanted to replace form's title bar with xp style looing title bar.
Please help me , How should i do that
_thanx Tag: WinForms question... Tag: 82032
Xp Style title bar
Hi
I wanted to replace my form title bar with xp style looking title bar.
Please help me how should i do that..
thanx.. Tag: WinForms question... Tag: 82030
Xp Style title bar
Hi..
I wanted to replace form's title bar with new one which will look like xp
form title bar
-Thanx Tag: WinForms question... Tag: 82029
Hi!
How do I determine the windows standard vertical scrollbar width in pixels
(set from the display properties) from c# code?
See the static VerticalScrollBarWidth property of the SystemInformation
class.
--
Tim Wilson
.Net Compact Framework MVP
"Peeter Ilumäe" <peeter@somewhere.com> wrote in message
news:%23e3xMpb7EHA.1596@tk2msftngp13.phx.gbl...
> Hi!
>
> How do I determine the windows standard vertical scrollbar width in pixels
> (set from the display properties) from c# code?
>
>
>
> Peeter.
>
>