Blank DataGrid
Hello:
This must be quite simple! But I couldnt figure out whats wrong:
I have this following code, and I still see a blank datagrid:
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim conn As New SqlConnection("****")
Dim da As New SqlDataAdapter("Select * from tblNote where CDID
= 55", conn)
Dim ds As New DataSet
Dim dt As New DataTable
da.Fill(ds)
If (ds.Tables(0).Rows.Count > 100) Then
dt = Get100Rows(ds.Tables(0))
End If
dt.AcceptChanges()
Dim dv As New DataView(dt)
Try
DataGridView1.DataSource = dv
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Function Get100Rows(ByRef dt As DataTable) As DataTable
Dim dt1 As New DataTable
Dim i As Integer
For i = 0 To 99
dt1.ImportRow(dt.Rows(i))
Next
dt1.AcceptChanges()
Get100Rows = dt1
End Function
End Class
I can see that the DataTable dt has 1000 rows. The datagrid does get
populated if I were to have Tables(0) of the DataSet ds as the
DataSource.
TIA.
Skandy Tag: Keydown Event Tag: 99671
DataGridView Columns Collection Editor
Hello
I am creating a UserControl that has a DataGridView control as a member.
I want to expose the column collection of the DataGridView, as a property of
my control.
in my code I have:
[Browsable(true)]
public DataGridViewColumnCollection myDGVCC
{...
but I get the generic collection editor, not the editor the normally is
invoked when modifying the columns of a DatGridView control.
Is there any way I can set the Columns property of my UserControl to use the
proper editor.
Thanks in advance
(Sorry for cross posting, not sure for the best place, and my english to) Tag: Keydown Event Tag: 99670
VB6-MDI child in .NET application
Is it possible to integrate a VB6 MDI child form into a .NET
application? How is it done?
Thank you
Karl-Heinz Tag: Keydown Event Tag: 99668
How to catch clicks on contained controls in the form.
I would like to capture, in my form, any mouse clicks on controls contained
in the form.
I know I can do this using a mouse hook, but that has a few problems with
catching clicks on dialogs the form owns that I have not been able to work
out.
I want to catch the click, so I can lock the data source, and then let the
click go on its merry old way.
Any simple solutions that I am overlooking?
Thanks,
/ken Tag: Keydown Event Tag: 99666
Open Non-Modal Form from MDI Application
I have an application that has an MDI main page. I would like to open up
multiple non-modal forms for some of the items within that MDI application.
Essentially, I want to open SDI forms from and MDI main application. I have
the forms open, but they don't open up on top and with focus. I need to know
how to have them open on top with focus. Here is the code I have.
Dim exists As Boolean = False
For Each f As Form In My.Application.OpenForms
If f.Tag = nodeTag.Substring(1) Then
exists = True
f.Activate()
End If
Next
If Not exists Then
Dim act As New frmActivities
act.Tag = nodeTag.Substring(1)
act.Show()
act.Activate()
End If Tag: Keydown Event Tag: 99661
Adding Control to a Form from another thread
In the background I want to load some control after form loaded.
I tried threading but it does not allow me to add control because current
thread have not created the form.
Also please tell me what BackGroundWorker control suppose to do.
How do I do it.
Please advise me.
Thanks, Dan Tag: Keydown Event Tag: 99658
ClosingEventArgs 'Cancel' member already set to true by framework
I'm having a difficult time trying to track this issue down. Hopefully,
someone might be able to share some insight.
I have a situation where a form is not closed when I explicitly call Close()
on it. As part of trying to debug this problem, I overrode the "OnClosing"
method (and OnFormClosing, too) and noticed that the 'Cancel' member of the
ClosingEventArgs parameter is already set to true upon entering and before I
explicitly forward the call to base.OnClosing(). If I force Cancel to be
false, then the form will close without a problem.
Does anyone have an idea why the framework is setting Cancel to true?
It is difficult to reproduce the problem with a small example. What I can
tell you is that the form in question is a TopLevel (and TopMost) form with
the Owner property set to an MDI child. The TopLevel form has a splitter
control that houses two child forms... however, I remove the splitter control
from the form before I call Close() (the form then contains no child
controls). This is the point where the form fails to close. Tag: Keydown Event Tag: 99657
Clipboard events
Hello ,
Does any one know if the clipboard fires any events (oncopy, onpaste)?
I would assume it does. If so, how would an application handle such an
event? The clipboard class itself does not have one. I am looking to change
the state of a button in my app when another app pastes something on the
clipboard.
Any help is greatly appreciated! Tag: Keydown Event Tag: 99656
set a NotifyIcon to "Always Show"
Hi,
I've got an application that, when minimized, displays a NotifyIcon in the
System Tray.
Is there anyway to get that icon to be set to "Always Show" in WinXP?
What I mean is, XP allows the user to classify icons in the system tray as
"Hide when inactive" (default), "Always Show" and "Always Hide". I would like
my application to be set to "Always Show". Is that possible?
Thanks,
Doug Tag: Keydown Event Tag: 99652
Accessing a form being created
Hello,
I would like to know if it possible to receive an event or intercept a
message so I can access every form I create in my application. I want to
add some functionality to my forms, but I want to do it in runtime. Is
it possible to be notified every time a new form is created and before
it is shown, so I can access it, for example, to add one specific
control to it or to subscribe an event?
Thanks in advance for any help given.
Regards,
paulo Tag: Keydown Event Tag: 99650
Accesing form's components in design time
Hi,
I need to access all components of a winform (controls, and any other
component which does not inherit from System.Windows.Forms.Control) both in
design and run time.
In design time I access the components and iterate through them using form's
Component property, but in run time this property is null. I can access all
the controls using form's Controls property, but I need to access also the
other components such as ContextMenu, ToolTips... which are not Controls.
How can I get this?
Thanks in advance. Tag: Keydown Event Tag: 99635
Exception in InitializeComponent
On my test run-time machine my application is generating a "... has
encountered a problem and needs to close..." exception from WITHIN the
InitializeComponent section of my main form. This is curious since if I do a
full install on my development machine it runs without a problem.
This has happened to be before and I traced it that time to a form control
using a font which was not on the target machine (why can't it just use a
default font in this case??), but I've double checked all fonts used this
time, and all seems to be ok.
So my question is in general: how can I find out where it's going down in
cases such as this? The "report contents" generated by the exception seem to
give me little clue. Tag: Keydown Event Tag: 99633
mysterious resize behavior...
I have developed a custom Control inheriting from
System.Windows.Forms.Control
It has some children control.
Something really weird happen when I resize it, its children control move!
Even though I have specified Anchor = AnchorStyle.None & Dock =
DockStyle.None (and I checked with the debugger that they still equals to
that).
Any idea why it is so?
I have setup a break point on an event handler of the move event to
understand what's going on. (stack trace below).
starting with #### are the method I implement (but none set
Location/bounds/whatever), very mysterious...
any idea?
> #####
> PowerGui.dll!PowerGui.Grid.DefaultGridCell<System.Windows.Forms.TextBox>.control_Move(object
> sender = {Text = ""}, System.EventArgs e = {System.EventArgs}) Line 265 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.OnMove(System.EventArgs
e) + 0x71 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.OnLocationChanged(System.EventArgs
e = {System.EventArgs}) + 0x26 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.UpdateBounds(int x,
int y, int width, int height, int clientWidth, int clientHeight) + 0x95
bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.UpdateBounds() +
0x1e8 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref
System.Windows.Forms.Message m) + 0x696 bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBoxBase.WndProc(ref
System.Windows.Forms.Message m) + 0x8e bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBox.WndProc(ref
System.Windows.Forms.Message m) + 0x97 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref
System.Windows.Forms.Message m) + 0xd bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref
System.Windows.Forms.Message m) + 0xd6 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr
hWnd, int msg = 3, System.IntPtr wparam, System.IntPtr lparam) + 0x75 bytes
[Native to Managed Transition]
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DefWndProc(ref
System.Windows.Forms.Message m = {msg=0x47 (WM_WINDOWPOSCHANGED)
hwnd=0x1a1072 wparam=0x0 lparam=0x3bebca8 result=0x0}) + 0x94 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.DefWndProc(ref
System.Windows.Forms.Message m) + 0xc bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WmWindowPosChanged(ref
System.Windows.Forms.Message m = {msg=0x47 (WM_WINDOWPOSCHANGED)
hwnd=0x1a1072 wparam=0x0 lparam=0x3bebca8 result=0x0}) + 0x24 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref
System.Windows.Forms.Message m) + 0x7a5 bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBoxBase.WndProc(ref
System.Windows.Forms.Message m) + 0x8e bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBox.WndProc(ref
System.Windows.Forms.Message m) + 0x97 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref
System.Windows.Forms.Message m) + 0xd bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref
System.Windows.Forms.Message m) + 0xd6 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr
hWnd, int msg = 71, System.IntPtr wparam, System.IntPtr lparam) + 0x75 bytes
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.dll!System.Windows.Forms.Control.SetBoundsCore(int x,
int y, int width, int height, System.Windows.Forms.BoundsSpecified specified
= None) + 0x194 bytes
System.Windows.Forms.dll!System.Windows.Forms.TextBoxBase.SetBoundsCore(int
x, int y, int width, int height, System.Windows.Forms.BoundsSpecified
specified) + 0xc4 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.SetBounds(System.Drawing.Rectangle
bounds, System.Windows.Forms.BoundsSpecified specified) + 0x101 bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.DefaultLayout.ApplyCachedBounds(System.Windows.Forms.Layout.IArrangedElement
container = {TestNGuiVisual.Grid.GridDemo}) + 0x111 bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.DefaultLayout.xLayout(System.Windows.Forms.Layout.IArrangedElement
container = {TestNGuiVisual.Grid.GridDemo}, bool measureOnly, out
System.Drawing.Size preferredSize) + 0x164 bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.DefaultLayout.LayoutCore(System.Windows.Forms.Layout.IArrangedElement
container, System.Windows.Forms.LayoutEventArgs args) + 0x19 bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.LayoutEngine.Layout(object
container, System.Windows.Forms.LayoutEventArgs layoutEventArgs) + 0x19
bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.OnLayout(System.Windows.Forms.LayoutEventArgs
levent) + 0x78 bytes
#####
PowerGui.dll!PowerGui.Controls.ScrollView.OnLayout(System.Windows.Forms.LayoutEventArgs
levent = {System.Windows.Forms.LayoutEventArgs}) Line 700 + 0xa bytes C#
#####
PowerGui.dll!PowerGui.Grid.GridView.OnLayout(System.Windows.Forms.LayoutEventArgs
levent = {System.Windows.Forms.LayoutEventArgs}) Line 329 + 0x9 bytes C#
System.Windows.Forms.dll!System.Windows.Forms.Control.PerformLayout(System.Windows.Forms.LayoutEventArgs
args) + 0xa7 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(System.Windows.Forms.Layout.IArrangedElement
affectedElement, string affectedProperty) + 0x2e bytes
System.Windows.Forms.dll!System.Windows.Forms.Layout.LayoutTransaction.DoLayout(System.Windows.Forms.Layout.IArrangedElement
elementToLayout, System.Windows.Forms.Layout.IArrangedElement
elementCausingLayout, string property) + 0x2c bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.OnResize(System.EventArgs
e = {System.EventArgs}) + 0x48 bytes
##### PowerGui.dll!PowerGui.Controls.ScrollView.OnResize(System.EventArgs
e = {System.EventArgs}) Line 605 + 0xb bytes C#
##### PowerGui.dll!PowerGui.Grid.GridView.OnResize(System.EventArgs e =
{System.EventArgs}) Line 297 + 0x9 bytes C# Tag: Keydown Event Tag: 99625
Listview selection on group click
Hi,
I am loosing my selected item when user click on a group in details modes.
Causes error and I would always like 1 item to be selected.
Any Ideas? Tag: Keydown Event Tag: 99623
PLS HELP:Managing events
Hi,
I'm developing a usercontrol which has an event SelectedValueChanged.
Below is the simple version of what i have:
//------------------------------
class SelectedValueChangedArgs: EventArgs
{
object m_oValue;
public SelectedValueChangedArgs(object oValue)
{
m_oValue = oValue;
}
public object Value {get{return m_oValue;}}
}
//--
public delegate SelectedValueChangedHandler(object sender,
SelectedValueChangedArgs e);
//--
public MyControl{
public SelectedValueChangedHandler SelectedValueChanged;
}
//-----------------------------------
The problem is that i have to make sure that any event handler added to
that event is added only once, so i should use it like this:
SelectedValueChangedHandler h = new
SelectedValueChangedHandler(SomehandlerFundction);
myControl.SelectedValueChanged -= h;
myControl.SelectedValueChanged += h;
But the problem is that i can't control all 30 developers in the company
and i ended up spending the whole weekend cleaning up after them (adding
-= to make sure the handler is not added second time somewhere).
So now i'm thinking of making the event protected and creating a
function which will be adding a handler:
// -------- CODE ---------
class MyControl{
<...>
public void AddSelectedValueChagedHandler(SelectedValueChangedHandler h)
{
SelectedValueChanged -= h;
SelectedValueChanged +- h;
}
}
///-----------------------
Is there a standard way/pattern to make my life easier here? :) I think
i've seen somewhere that you can override -=/+- for an event or
something like that. I still would like to go with event instead of a
wrapper function as above.
Any ideas/comments are HIGHLY APPRECIATED!!!
Thank you in advance,
MuZZy Tag: Keydown Event Tag: 99621
Forms 8 - 10x Slower to load on .NET 2.0 with X64 executable why?
With "Any CPU" chosen my application is 8-10x slower loading/displaying
forms the first time they are loaded than if I choose X86 as my target.
All of the controls on the form are .NET 2.0 compiled controls (devexpress)
so I don't know what's going on.
Anyone have any ideas?
Thanks,
James Hancock Tag: Keydown Event Tag: 99618
Write to Appname.exe.config
I can use System.Configuration classes:
string dns = ConfigurationSettings["name"];
to access the appSettings configuration
<configuration>
<appSettings>
<add key="name" value="val" />
</appSettings>
</configuration>
Isn't there a Class or Method to write values to the appSettings
or for that matter Custom Configuration settings or
Section Groups?
thanks Tag: Keydown Event Tag: 99616
Merging menuitems : nobody knows the answers ???
hi,
i've posted this message at the start of last weekend, maybe that's why I
didn't receive any answer (I know there are better things to do than sit in
front of a computer a whole weekend)
that's why I'll post again now.
--->
when adding items to a MenuStrip VS 2005 defines them as objects of type
ToolStripmenuItem ??? I would expect MenuItems (as in VS 2003). (Why this
change ?)
Thing is, I would like to merge menuitems using the MergeMenu-method, but
this method is nowwhere to be found in ToolStripmenuItem.
So, how does one merge (toolstrip)menuitems in VS 2005 ?
thanks
Chris Tag: Keydown Event Tag: 99609
SuspendLayout and Multiple Controls
I am looking at ways to reduce the visible delay in a form I have with
many controls. I have two methods that loop across and either enable or
disable all but two of the controls.
I am using SuspendLayout and ResumeLayout at the form level, but so far
I don't see any real improvement because of it. Is there a better way to
handle disabling / enabling large volumes of controls?
I wish I could buffer the form paint surface and have it render off
screen, then just paint the one image after the controls have all
completed their painting.
Thoughts appreciated. Tag: Keydown Event Tag: 99606
Code signing with PFX certificate
Hello,
I created a certificate to sign a NET WinForm control. The certificate was
locally generate on a Win2K server, I also tried using a Win2003 server.
When I assign the Assembly keyfile with the certificate file and compile the
C# control I get a "bad version provider" error.
As a additional information I have used the Win2K server to sign macros in
the past with no problems at all. This seems to be related to NET framework
1.1.
I looked up on msdn and couldn't find information about this error. I will
appreciate help to resolve this.
thank you
Carlos Lozano Tag: Keydown Event Tag: 99603
How to get ListItemValue and ListItemText from a Combo using SendMessage
I am new to interop services as well as the Windows API in general. What is
the proper way to obtain the ListItemValue and the ListItemText using the
windows API? I would like to be able to read a combo's list values from a
windows form application (ComboBox) and also from a combo on a web page
(Internet Explorer_TridentCmboBx). I can not seem to locate much
documentation or even code examples. I am using C#.
Thanks
Matt Tag: Keydown Event Tag: 99602
datagridview add a combobox to a single cell, not a whole column
I would like to have a DataGridView that has a column in it that contains a
combobox only on certain rows. I have searched the web and the only solution
I have found is to create a custom DataGridView control. There must be an
easier way to do this. Any suggestions?
-- Mikeq Tag: Keydown Event Tag: 99598
goofy title bars in WMI application
Hello,
I would certainly appreciate some feedback to the issue I'm experiencing in
my first major WMI application. When I navigate to a new child form I
usually dispose of the one I'm navigating from, but I often end up with
multiple title bars as shown in the following screenshot. I've tried setting
the child forms' FormBorderStyle = None but that doesn't seem to help.
http://www.senske.com/images/wmi-goof.jpg
Can anyone please give me a few pointers to what I might be doing wrong?
Thanks in advance,
Andre Ranieri Tag: Keydown Event Tag: 99597
How to change all disabled controls backcolor
I need to change the color used by windows to paint the backcolor of all
disabled controls in my application, because users, in certain conditions of
light, can't read the text.
I Think that I need to change something like SystemColors.GrayText, but it
seems to be readonly...
My application was developed using C# 2005.
Thank you Tag: Keydown Event Tag: 99596
How to get an Office 2007-style ribbon toolbar?
Is there anyone who knows how to get a ribbon-toolbar (like the ones in
Office 2007) in a VB.NET 2005 application? Is there some patent prohibiting
people from using it? Any help would be appreciated. Tag: Keydown Event Tag: 99593
Add an Image to the Dataviewgrid Button Column
Hi,
Is it possible to display an image in all buttons in a
datagridview(Windows Forms) button column?
Thank you,
Roby Eisenbraun Martins Tag: Keydown Event Tag: 99589
Trying to "display" control characters in a text box
I have a barcode scanner which uses a "keyboard wedge" program so that the
data it scans comes through as if it was typed on a keyboard. I am trying
to have the data in the barcode be displayed in a text box. I know that
there are certain control characters embedded in the data that I want to
display substitutions for in the text box, for instance I want to replace
ASCII character 04 with the string "<EOT>". I have tried doing a simple
replace in the TextChanged event, but it appears that the Textbox Control
strips out the control characters as they come in. I also tried catching
the "keystrokes" using the KeyUp event, but that seems to have done
something (and I can't figure out what) with some of the control characters
and added other characters that are not in the data. Does anyone have any
suggestions as to how I can accomplish this? I know what the data encoded
in the barcode is, and I can verify that the scanner is reading it
properly - I just can't get it into a VB.Net text box properly.
TIA
Ron L Tag: Keydown Event Tag: 99586
Combo Box-Keydown event
A Simple DropDown style combo box fires two KeyDown events when Enter key is
pressed. How it can be fixed? Tag: Keydown Event Tag: 99574
Customise datagridview column does not bind into data field ?
My Customise datagridview column Code like this, it does not bind the data
into data field. When i go to next row of data, the column refresh back to
empty. Looking for any solutions. Thank you.
public class DateTimeTextBoxCell : DataGridViewTextBoxCell
{
private static Type defaultEditType =
typeof(DateTimeTextBoxEditingControl);
private static Type defaultValueType = typeof(System.DateTime);
public DateTimeTextBoxCell(): base()
{ }
public override void InitializeEditingControl(int rowIndex, object
initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
{
base.InitializeEditingControl(rowIndex, initialFormattedValue,
dataGridViewCellStyle);
DateTimeTextBoxEditingControl datetimeTextBox =
DataGridView.EditingControl as DateTimeTextBoxEditingControl;
DataGridViewColumn dateTimeTextBoxColumn =
this.DataGridView.Columns[this.ColumnIndex];
string initialFormattedValueStr = initialFormattedValue as string;
if (dateTimeTextBoxColumn is DataGridViewDateTimeTextBoxColumn)
{
datetimeTextBox.FieldType =
(winControl.TextBox.enumDataType)this._fieldtype;
if (initialFormattedValueStr == null)
datetimeTextBox.Text = string.Empty;
else
datetimeTextBox.Text = initialFormattedValueStr;
}
}
public override Type EditType
{
get { return typeof(DateTimeTextBoxEditingControl); }
}
public override Type ValueType
{
get
{
Type valueType = base.ValueType;
if (valueType != null)
return valueType;
return defaultValueType;
}
}
public override object DefaultNewRowValue
{
get{ return ""; }
}
public override object Clone()
{
DateTimeTextBoxCell dataGridViewCell = base.Clone() as
DateTimeTextBoxCell;
return dataGridViewCell;
}
}
public class DataGridViewDateTimeTextBoxColumn : DataGridViewColumn
{
public DataGridViewDateTimeTextBoxColumn(): base(new
DateTimeTextBoxCell())
{
}
public override DataGridViewCell CellTemplate
{
get{ return base.CellTemplate; }
set
{
DateTimeTextBoxCell dateTimeTextBoxCell = value as
DateTimeTextBoxCell;
if (value != null && dateTimeTextBoxCell == null)
{
throw new InvalidCastException("Value provided for
CellTemplate must be of type DataGridViewDateTimeTextBox or derive from
it");
}
base.CellTemplate = value;
}
}
public override object Clone()
{
DataGridViewDateTimeTextBoxColumn obj =
(DataGridViewDateTimeTextBoxColumn)base.Clone();
return obj;
}
}
class DateTimeTextBoxEditingControl : DateTimeTextBox,
IDataGridViewEditingControl
{
System.Windows.Forms.DataGridView dataGridView;
private bool valueChanged = false;
int rowIndex;
public DateTimeTextBoxEditingControl()
{ this.textBox.Leave += new
System.EventHandler(this.DateTimeTextBox_Leave);
}
private void DateTimeTextBox_Leave(object sender, System.EventArgs
e)
{
valueChanged = true;
this.EditingControlDataGridView.NotifyCurrentCellDirty(true);
}
public Cursor EditingPanelCursor
{
get { return Cursors.IBeam; }
}
public virtual System.Windows.Forms.DataGridView
EditingControlDataGridView
{
get { return dataGridView; }
set { dataGridView = value; }
}
public object EditingControlFormattedValue
{
get { return this.textBox.Text; }
set { this.Text = value.ToString(); }
}
public object GetEditingControlFormattedValue(
DataGridViewDataErrorContexts context)
{
return EditingControlFormattedValue;
}
public bool EditingControlWantsInputKey(Keys key, bool
dataGridViewWantsInputKey)
{
switch (key & Keys.KeyCode)
{
case Keys.Left:
case Keys.Up:
case Keys.Down:
case Keys.Right:
case Keys.Home:
case Keys.End:
case Keys.PageDown:
case Keys.PageUp:
return true;
}
return !dataGridViewWantsInputKey;
}
public void PrepareEditingControlForEdit(bool selectAll)
{
}
public bool RepositionEditingControlOnValueChange
{
get{return false;}
}
public int EditingControlRowIndex
{
get{return rowIndex;}
set{rowIndex = value;}
}
public void ApplyCellStyleToEditingControl( DataGridViewCellStyle
dataGridViewCellStyle)
{ }
public bool EditingControlValueChanged
{
get{return valueChanged;}
set{valueChanged = value;}
}
}
// DateTimeTextBox control contain Textbox (for display date string) +
button (for call datetimepicker)
// the DateTimeTextBox DefaultBindingProperty("DataText")
// the problem is when navigated to new row, the column value show empty /
null, it does not save input into datatable
[System.ComponentModel.DefaultBindingProperty("DataText")]
public partial class DateTimeTextBox : UserControl
{
.......
[System.ComponentModel.Bindable(true), Browsable(true),
Category("Behavior"), Description("Date and Time displayed")]
public virtual String DataText
{
get
{
try
return
DateTime.Parse(this.textBox.Text).ToString("dd-MMM-yyyy",
Application.CurrentCulture);
catch
return null;
}
set
{
try
this.textBox.Text = string.Format("{0:dd-MMM-yyyy}",
DateTime.Parse( value ));
catch
this.textBox.Text = value;
}
}
} Tag: Keydown Event Tag: 99573
Combo Box
I have a ComboBox bound to a dataset. I want to add an Item "<Select an
Entry>" to the combo box. It is in addition to the items already added to the
control through the Dataset (From DB). How it can be done?
Thanks. Tag: Keydown Event Tag: 99572
TimeSpan column (or something similar) in a DataGridView
I'm looking for an article or maybe some free advice (yes, I've been
searching around...)
I am to implement a time card in a DataGridView bound to a SQL Server
2005 table. There are DateTime columns (time in, time out) and columns
with elapsed time in them (e.g. lunch) which _could_ be done with
TimeSpans (I think). How best to go about this?
1) Which database type would best represent the elapsed time?
(datetime, integer representing # of minutes, or ...?)
2) What corresponding built-in .net class or custom type would go with
that on the client?
3) Once I've got the underlying type nailed down I can develop the
custom column myself, but if anyone's done this before I ain't too
proud to beg for sample code Tag: Keydown Event Tag: 99570
Monitoring user interaction with the axWebBrowser control
Hi all,
I have a vs2005 winform that host the activex axWebBrowser control.
I would like to monitor how long a user spends on a site viewed in the web
browser control, In the web world this would usually be done on the web
server by using some sort of caching or session objects. Is it possible to
determine how long a user spends on a given site using the web browser
control?
Any replies, links, articles, or books on the above subject would be greatly
appreciated.
Regards,
-.NET Dev Tag: Keydown Event Tag: 99560
Exception when use MessageBox.Show in prog with long path
All -
I haven't come across this issue elsewhere, or in a search within this
newsgroup. Perhaps someone here has come across it...
In both 1.1 (SP1) and 2.0, when using MessageBox.Show in a simple Windows
app (only shows the messagebox), and with the .EXE file sitting at a
location where its total path length is greater than 128 characters, the EXE
doesn't work.
In .NET 1.1, a NullReferenceException is thrown inside MessageBox.ShowCore.
In .NET 2.0, nothing at all happens (the app just exits). Even with all
exceptions set to be trapped in the debugger, there's no exception at all.
If the same .exe is moved to a higher-level folder, such that its total path
is less than 128 chars, it works fine.
Any clues?
Thanks,
Jeff Tag: Keydown Event Tag: 99559
Merging ActiveX Control
Hi Every body,
I am currently working in aproject where I am stuck in merging an
ActiveX control (*.ocx) file into a managed Class Library (*.dll). I want to
hide the ActiveX Control in this managed Dll, so that even when things are
deployed I don't wanna see two files, but only 1 file which is the dll, and
it would contain within it, the other ocx file.
Is this possible? If yes, then how can I do something like this, I tried to
use ILMerge, but it sounds that it doesn't do what I wanted to have..
Thanks
Khaled Hussein Tag: Keydown Event Tag: 99556
newbie: multiple panels in form
Hi,
I'm writing an application that makes use of multiple panels (that contain
specific components), but shows only one to the user at a time (which one
depends on user interaction in a toolbar).
Now, as all panels have the same size and the same position in the form,
it's quite annoying to work with (esp. if you want to change a thing in the
'lowest' of the overlapping panels). so, as a newbie, I'd better ask if there
is any better way to handle this or a Visual Studio feature that makes life
easier?
Greetings,
Peter Tag: Keydown Event Tag: 99554
PropertyGrid bug with Permissions
I think I'm encountering a bug in the PropertyGrid control when I use it in
conjunction with Permissions. I get an IndexOutOfRangeException whenever the
grid updates itself (for instance, when I set SelectedObject, or call
Refresh()).
Here's the stack trace from the test application I put together (code
below). I also get this stack trace in my main application if I call
Refresh() on the PropertyGrid before the form it is on has been shown, and
before I've assigned a SelectedObject.
-----
at System.Windows.Forms.PropertyGrid.RefreshProperties(Boolean clearCached)
at System.Windows.Forms.PropertyGrid.Refresh(Boolean clearCached)
at System.Windows.Forms.PropertyGrid.set_SelectedObjects(Object[] value)
at System.Windows.Forms.PropertyGrid.set_SelectedObject(Object value)
[My Code]
-----
Here's the stack trace I get from my main application if I don't set the
SelectedObject until after the form containing the PropertyGrid is displayed
(it is instead set in response to a mouse click on another control).
-----
at System.Windows.Forms.PropertyGrid.UpdatePropertiesViewTabVisibility()
at System.Windows.Forms.PropertyGrid.ShowEventsButton(Boolean value)
at System.Windows.Forms.PropertyGrid.set_SelectedObjects(Object[] value)
at System.Windows.Forms.PropertyGrid.set_SelectedObject(Object value)
[My Code]
-----
The code for the test application that I mentioned:
-----
using System;
using System.Drawing;
using System.Drawing.Printing;
using System.Windows.Forms;
using System.Security.Permissions;
namespace PropertyGridTest {
public class Form1 : Form {
private PropertyGrid PropertyGrid1;
public Form1() {
PropertyGrid1 = new PropertyGrid();
SuspendLayout();
PropertyGrid1.Dock = DockStyle.Fill;
PropertyGrid1.SelectedObject = PropertyGrid1; // exception
ClientSize = new Size(292, 273);
Controls.Add(PropertyGrid1);
ResumeLayout(false);
}
[STAThread]
static void Main() {
// FileIOPermission Permission = new
FileIOPermission(FileIOPermissionAccess.Read,"C:\\temp");
// FileIOPermission Permission = new
FileIOPermission(FileIOPermissionAccess.AllAccess,"C:\\temp");
// PrintingPermission Permission = new
PrintingPermission(PrintingPermissionLevel.SafePrinting);
EnvironmentPermission Permission = new
EnvironmentPermission(EnvironmentPermissionAccess.AllAccess,
"HKEY_CURRENT_USER");
Permission.Deny();
Application.Run(new Form1());
}
}
}
-----
This problem seems to happen no matter which permission I deny or how that
permission is configured. The exact same thing happens with any of those
commented out permissions. However, the problem goes away completely if you
just comment out the Permission.Deny() line.
Any ideas, help, or work-arounds would be very much appreciated.
Thanks! Tag: Keydown Event Tag: 99553
Printing HTML from Window Forms
What's the best way to print an html document generated in a Windows forms
application?
IE (WebBrowser control) works pretty well; with some effort to use a print
template, you can control margins, headers, footers, and get print preview.
The 'gotcha' is that (as best I can tell), there's no good way to specify the
printer that you want to print to. I tried calling the windows api to set
the default printer, and this works sometimes, but my application needs to
send different print jobs to different printers, and the selections sometimes
'step on' each other when you switch the default printer.
I also looked at the ReportViewer, but I could not find a way to get it to
render html.
Am I missing something? Surely there's a good way to print html from
Windows forms. Tag: Keydown Event Tag: 99552
eMoovie - a new company - we need sponsors
Hello !
We are eMoovie, a young swiss start-up based in Geneva. We developed
SICMovie, a novel technology for VOD security. This technology is not a DRM
but a DRT (Digital Rights Tatoo).
The goal of DRT is not to control the customer's use of the downloaded movie
but to give him responsibilities over the use of the file, and thus to unite
copyright and private copy right (Fair use) in one system.
We need capital from sponsors and private investors in order to continue our
development.
Please visit our website: http://www.emoovie.com
eMoovie Team Tag: Keydown Event Tag: 99550
highlighting in VS 2005
In VS 2003, the IDE would highilght the starting of a looping structure when
I would type in something like "break" or "continue". This was helping to
know what the break/continue was related to. Is there a way to turn this on
in VS 2005?
Amil Tag: Keydown Event Tag: 99548
problems with MenuItems
hi,
when adding items to a MenuStrip VS 2005 defines them as objects of type
ToolStripmenuItem ???
I would expect MenuItems (as in VS 2003). Why this change ?
Thing is, I would like to merge menuitems using the MergeMenu-method, but
this method is nowwhere to be found in ToolStripmenuItem.
So, how does one merge (toolstrip)menuitems in VS 2005 ?
thanks
Chris Tag: Keydown Event Tag: 99547
Winform with HelpProvider control loses focus.
Hello everybody.
I have a Winform with a HelpProvider control.
Everything works as expected when I push the F1 key (I see the help
window with my .chm help file). However, when I close the help window,
the focus doesn't go back to the application's main form.
It's not a big problem, but it's very annoying for the user, who has to
Alt+tab to the application or click into it.
If you try launching the help window with Internet Explorer, for
example, after closing the help the focus goes back to the main window.
Is there a way to obtain that behavior in .NET?
Thanks in advance Tag: Keydown Event Tag: 99546
Using WebBrowser to open office documents inside a Windows Forms Form
Using Visual Studio.Net 2005 Team Edition for Software Developers on a
Windows XP machine.
Microsoft Support article 304662, dated 1/10/2006 shows how to use the
WebBrowser control to open word/excel documents inside a Form.
http://support.microsoft.com/?id=304662
The basic code works - I can put a WebBrowser control into a form and then
call webBrowser1.Navigate( url ) and if 'url' is a .doc or a .xls file,
word/excel open and display the document. Very cool!
However, the article goes on to say that you can then get ahold of the
automation object from within the "NavigateComplete2" event handler (see
steps 7 and 8 in the article).
However, the webBrowser1 object created by the designer does not appear to
have a 'NavigateComplete2' method (event) and I can find no help for the
'AxSHDocVw' class referenced in the parameter list for the NavigateComplete2
event handler code.
The fact that the article's code has a WebBrowser instance named
'axWebBrowser1' leads me to believe that I do not have the same WebBrowser
class used in the article. The article is dated 1/10/06, so it appears very
current and specifically mentions that it applies to .Net 2005.
Has anyone gotten this to work?
thanks!
john Tag: Keydown Event Tag: 99545
Cannot find assembly error
I've spent half today trying to figure this out to no avail. I have a
solution, using remoting, with 13 projects. The assemblies are using a
strong name key and things were working fine until today when I tried to
change the version number on some of the assemblies. I changed the intially
called assembly to be ver 1.0.0.2, from 1.0.0.0. NOw when I start the
application I receive the error "Cannot find the assembly ...
version=1.0.0.0" Where is it getting this reference to version 1.0.0.0?
I've changed all the assemblies to be version 1.0.0.2 but it's giving me this
error and I can't proceed. Any help is greatly appreciated. Tag: Keydown Event Tag: 99541
Catch event when DataGridViewComboBoxCell value changed
I'm trying to catch an event when the value of a
DataGridViewComboBoxCell changes...without having to tab/click off the
DataGridViewComboBoxCell. Thank you for any help you might be able to
offer. Tag: Keydown Event Tag: 99531
3 Tier architecture
Please clear my doubt and give some suggestion.
I am new to software development, and want to implement a n-tier
application.
I have a very basic idea about n-tier architecture.
[Example]
I have created a Business Layer(dll) and put it on a network shared
directory.
From the presentation layer project I have added the reference of Business
Layer(dll).
Can I call this a n-tier application.
Or n-tier means that I need to execute/process the Business Layer where it
presents(using remoting or any other way).
Please clear my doubt.
Thanks for any help you can provide.
Dan Tag: Keydown Event Tag: 99530
<%><%><%><%>HOW TO BE FUNNY!<%><%><%><%>
You too can learn to be funny in just 7 days flat:
http://www.ExpertHumor.com/HowToBeFunny.htm
*** Free account sponsored by SecureIX.com ***
*** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** Tag: Keydown Event Tag: 99525
>@>@>@>@>GET MORE CHICKS............LEARN GUITAR.............
Chicks dig guitar players.
So get more chicks!
Learn how to play guitar!
http://www.ExpertHumor.com/LearnGuitar.htm
*** Free account sponsored by SecureIX.com ***
*** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** Tag: Keydown Event Tag: 99522
<><><><><><><>The Net's #1 Joke e-Book!<><><><><><><><>
That's Comedy - Over 460 Pages of Little Snickers,
Medium-Sized Chuckles, and Great Big Belly Laughs:
http://www.ExpertHumor.com/That'sComedy.htm
*** Free account sponsored by SecureIX.com ***
*** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com *** Tag: Keydown Event Tag: 99518
Aboutbox with a list of the used Assemblies of an application.
I would like to make a list of all the ProductNames of the Assemblies used by
my application, made in C#/C-Sharp.
Can anyone tell me where I can find a list of the Assemblies, used by the
appilcation.
Regards
Karsten Lundsgaard Tag: Keydown Event Tag: 99516
A tab control receives all Keydown events when a key is pressed in any of the
controls on the Tab control. Is it normal behaviour?