Form.TopMost behaviour
I'm a bit confused regarding the behaviour when setting the Form.TopMost
property. If setting the property to 'true', does it make the form top-most
of all windows in all applications, or only the form's application ?
Searching google, I've found people claiming it's enough to set TopMost in
order for the form to be top-most of all windows in the system, and other say
that a call to Win API's SetWindowPos (with HWND_TOPMOST as a parameter) is
needed.
So, which is correct? Tag: .NET Framework 3 Tag: 104928
how to show a form or process command line args
Hello. I would like to write a console application and windows form
application all in one. If there are command line arguments, then I would
treat it as a console app. Otherwise, I would display a form. I'm having
trouble doing this. Any ideas??
Here's what I did so far:
1) Create a new console application
2) In the Main, i use this code, but it only briefly displays the form, then
it goes away. The code looks like this:
Sub Main(ByVal args() As String)
If args.Length = 0 Then
Dim frm As New frmMain
frm.Show()
frm.Focus()
Else
'....
End If
End Sub
Thank you in advance for your response!
Steve Tag: .NET Framework 3 Tag: 104925
Consuming JavaScript events fired in AxWebBrowser control
I have an AxWebBrowser control in a C# app. I'd like to have my C# app
capture, say, an OnClick event of an HTML element in the AxWebBrowser
document.
Is this possible?
TIA
Jared Tag: .NET Framework 3 Tag: 104923
Changing default header/footer when printing from AxWebBrowser
I've wrapped the web browser control in a user control, and I'm able to
print using the execCommand("Print") method. However, this puts "Page
X of Y" in the header, and "about:blank" and the date in the footer.
How can I override the default header and footers?
TIA
Jared Tag: .NET Framework 3 Tag: 104922
Validating a DataGridViewComboBoxCell on focus lost
Hi, i would like to make a DataGridViewComboBoxCell (which often is the
last-edited one) validate in such a way that when the datagrid lost the
focus the ComboBox cell Text property is setted to the combobox Value
property. I've already written all the code needed to change the
ComboBox view from a only-pushbutton style to a combobox style (with
the text box editable i mean) and to add the Text value to the ComboBox
Items and then setting the Value property of the ComboBox to the
original Text value. But all works correctly only if i change the
focus from the ComboBox cell to another cell. Instead if i click a
button outside the DataGridView the cell is not validated and so the
Value is not setted and remains null.
Is there a way to cause the validation of the DataGridView (and of the
ComboBox cell as well) when the DataGridView lost focus?
thanks Tag: .NET Framework 3 Tag: 104921
BeginInvoke and user-interaction
I have a datagrid whose datasource is being updated by a function started by
BeginInvoke.
If the user (as the datagrid is being populated) drags the scrollbar (or
even clicks it and doesn't release
the mouse-button) the datagrid-population is being stopped.
When the user release the mouse-button the datagrid-population is continued.
I would like the population of the datagrid to continue while the user drags
the scrollbar.
Is it possible and how can I achive this?
Thanks Tag: .NET Framework 3 Tag: 104915
What causes exception in ComboBox
When selecting last item in combobox I receive the following exception in VS:
System.ArgumentOutOfRangeException was unhandled
Message="InvalidArgument=Value of '31' is not valid for 'index'.
Parameter name: index"
ParamName="index"
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.ComboBox.ObjectCollection.get_Item(Int32 index)
at System.Windows.Forms.ComboBox.UpdateText()
at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef
hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam,
IntPtr lparam)
at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd,
Message& m)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at FAST.AppMain.Main(String[] args) in
C:\Dev\client_dev_shared_FAST2\FAST_UCM\FAST\client\FASTGUI\FAST
Application\Main.vb:line 25
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
I dont have any event handlers for the combobox and I'm not catching any
exceptions with the VS debugger. What gives, another bug? Tag: .NET Framework 3 Tag: 104914
Windows Forms Stylesheets?
Is there anything equivalent to CSS for use in windows forms? Iâ??d like to be
able to have the colors and fonts determined by some kind of configuration
file (ala Cascading Style Sheets) so that individual application users can
customize the user interface to there taste.
Is there any simple way to accomplish this? If not, does anyone have any
suggestions for methods or strategies to accomplish this?
Oh... by the way, I'm using Visual Studio 2003 & VB.NET but would happily
use Visual Studio 2005 if this functionality was built in.
Thanks,
Jonathan Tag: .NET Framework 3 Tag: 104910
datetime
I have a date value in a database and I want to show it's value on a form.
It is bound to the data and shown with a datetimepicker. When the value in
the database is null, an incorect value is shown on the form. is there a
way to get null to show when it is null? Tag: .NET Framework 3 Tag: 104901
Display ToolTip on TextBox
(Created on VS2003 using C#)
I have derived the TextBox control to create my own control that does a
lot of filtering and autocorrection of user input. I want to be able to
give feedback to the user when there's a problem the input he's trying
to do. A good example is in Windows XP if you go to windows explorer
and in the folders view try to rename a directory with "\", this will
result in a arrow tooltip to display saying that certain characters are
forbidden.
I was thinking of adding a ToolTop control to my TextBox control (yes I
know it's wasteful, but I could work something so they all use the same
tooltip, that I will work on later). Now in 2003 there's no .Show(...)
method for the ToolTip control, and I don't think my company is gonig
to migrate to 2005 before this week, when I have to release the
software.
Has anyone beem able to show the tooltip programatically without
waiting for the user to do a hover?
Thanks Tag: .NET Framework 3 Tag: 104900
Detect if Workstation is locked
Hi,
I want to detect in my C# app (can use iterop) if the workstation is locked.
I've seen on the web people saying it's impossible except by looking if the
Screensaver process is running. There must be a clean way of doing it
because MSN detects it and can change your status based on this.
Does someone have a solution to this please?
thanks
ThunderMusic Tag: .NET Framework 3 Tag: 104884
Form - mouse selected
I'm trying to enable my disabled menu options (cut, copy & paste). The
requirement is to determine what on my form has been selected with the mouse.
How can I determine this? Tag: .NET Framework 3 Tag: 104877
Forcing DataGridView to repaint a row/disabling a row
I have a datagridview that is bound to a datasource. The under lying
data is not from a database, but biz objects. The first colume (InUse)
is a check box to determine if the rest of the row is enabled. When
the row is not in use, it is grayed out in the CellFormatting event.
After the user checks the InUse colume, the rest of the row does not
get repainted.
Is there a better way to control editablity of individual rows? If
not, how do I go about making the whole row get updated correctly? As
I click on the different cells and leave them, they change to the
correct color. Tag: .NET Framework 3 Tag: 104876
outlook 2003 left panel look in c#
Hi
I'm wondering how can i make a control that looks like the left panel
of
outlook 2003 , i'm talking about the low part where you see mail,
calendar,
contacts. this panel you can set the height and the number of 'button'
will
change there is also a configure button to it.
how can i build a control that will look like that using C# 2.0
control, I
know that some 3rd party sell those but i don't want to buy those.
thanks Tag: .NET Framework 3 Tag: 104874
ComboBox Binding Problem
I am binding a Collection Business Object to a ComboBox in Visual Basic 2005
in a Windows Form Application. The SelectedValue is then bound to another
Business Object. When I create a new instance of the object I can use the
Combo to look up values but display member is being cleared on losing focus.
DisplayMember, Value Member, etc is set as per documentation and per other
similar threads in newsgroups. Some are reset after component initialised to
be doubly sure they are set. On Editing existing records combo does not
display any value, even though when tested the selected value is correct.
I tested code in same form with Janus Combo and it worked perfectly using
properties displaymember, valuemember and SelectedValue (Using
DataSourceUpdateMode.OnPropertyChanged ).
This would lead me to view I am doing everything correctly but the MS Combo
is not behaving correctly. Can anyone shed any light on this, is there a
bug with the control?
Regards Tag: .NET Framework 3 Tag: 104873
TypeDescriptor get Conveter attached to a property
I have class that has a property wich has a custom typeconverter:
class A
{
private string _property;
[TypeConverter(typeof(MyTypeConverter))]
public string Property
{
get { return _property; }
}
}
How can I get an instance of this typeconverter? When I do
A a = new A();
TypeDescriptor.GetConverter(a);
I get an instance of the default Typeconverter attached to the class A
(as expected).
When I do
TypeDescriptor.GetConverter(TypeDescriptor.GetProperties(a)[0].GetValue(a));
I get an instance of the default Typeconverter of the class string (as
expected).
How would I retieve the instance of MyTypeConverter attached to
Property ? Tag: .NET Framework 3 Tag: 104872
outlook 2003 left panel in c#
Hi
I'm wondering how can i make a control that looks like the left panel of
outlook 2003 , i'm talking about the low part where you see mail, calendar,
contacts. this panel you can set the height and the number of 'button' will
change there is also a configure button to it.
how can i build a control that will look like that using C# 2.0 control, I
know that some 3rd party sell those but i don't want to buy those.
thanks Tag: .NET Framework 3 Tag: 104869
Custom Control with Transparent Background
/*
How can I give my custom System.Windows.Forms.Control a transparent
background? In the small application below, I expect to see two partially
overlapping circles, a blue one and a red one, but only the blue circle
appears. When the background of the controls iis transparent, both circles
will show.
If this feature is not available or only through some kind of hack, what is
the reason that Microsoft does not support controls with transparent
background?
*/
using System.Drawing;
using System.Windows.Forms;
//class ColorCircleControl
class ColorCircleControl:Control
{
//data member brush
Brush brush;
//data members x,y
int x;
int y;
//constructor
public ColorCircleControl(Brush a,int b,int c)
{
brush=a;
x=b;
y=c;
SetStyle(ControlStyles.SupportsTransparentBackColor,true);
BackColor=Color.Transparent;
Dock=DockStyle.Fill;
Paint+=OnPaint;
}
//OnPaint
void OnPaint(object a,PaintEventArgs b)
{
b.Graphics.FillEllipse(brush,x,y,55,55);
}
}
//class MyForm
class MyForm:Form
{
//constructor
public MyForm()
{
Controls.Add(new ColorCircleControl(Brushes.Blue,34,55));
Controls.Add(new ColorCircleControl(Brushes.Red,55,55));
ClientSize=new System.Drawing.Size(233,144);
}
//Main
[System.STAThread]
static void Main()
{
System.Windows.Forms.Application.Run(new MyForm());
}
} Tag: .NET Framework 3 Tag: 104868
GDI objects count
Hello all,
Can somebody help me out regarding how to maintain the GDI objects
count in my application it keeps on incrementing and once reaches to
10000 the application dies. Can somebody point to me some sample
application which could help me to understand how exactly manage the
object disposal I have been reading the articles for memory management
and GC but things are getting more and more confused to me.
Needed help urgently
Thanks in advance Tag: .NET Framework 3 Tag: 104866
The good old Cross-thread operation not valid
Hi,
Does anyone know if there is a better solution for the good old
"Cross-thread operation not valid" than dealing with delegates and
Invokes? (This happens when you access GUI from a thread that did not
create it)
I realize that the problem is based on the old Windows requirement
(only thread that created the window shalt process its messages) but it
is 21 century and the new VS 2005 was supposed to be all about
productivity, concentrate on your buisness logic and do not write
plumbing code etc... If poluting your code with delegates and Invokes
just to do (txtBox1.Text = "Blah") is not plumbing I am not sure what
is....
Anyway, does anyone know if a better, more straightforward solution
exist? I guess the anonimous methods help a bit but it is still pretty
ugly. I also read about the BackgroudWorker component but that one is
not very intuitive either...
Ivan Tag: .NET Framework 3 Tag: 104858
Performance of form controls refreshing on Resize
Hi, I'm a little new to forms programming with C#, so I'd appreciate
some pointers on how I can improve the (perceived) performance of my
form when it's resized.
My form contains a TabControl, which has a couple panels, about 15 text
boxes + labels, and two comboboxes, all bound to a custom object. When
I resize the form, the controls on the form seem to resize/repaint very
slowly. I had thought there's a way to hide this repainting of each
control, to make the overall operation appear faster, but I'm not sure
where to handle that.
Thanks for any pointers,
Michael Tag: .NET Framework 3 Tag: 104856
Tracing not allowed in installed winforms application
I have tracing set up in my application to write out to a log file.
Now If I install the application from my setup project and try to run
it, I am getting an exception that says something along the lines of:
"UnauthorizedAccessException: ... Access to the path
...\myAppLogFile.log is denied"
I checked the permissions of the directory inside of program files and
sure enough, only administrators were allowed to Modify the files in
the directory. I was logged in as a non-administrator when I was
testing. When logged in as adminstrator, no problems arise.
Does anyone know of a good approach to this? Perhaps I should modify
the directory permissions on install?
Thanks,
Jonathan Tag: .NET Framework 3 Tag: 104850
Crystal Reports 'Logon failed' error
I have read all the postings in this forum for this dreaded unpopular error,
but I haven't found a resolution to my problem yet and I really need to get
this bug resolved. I have a winforms app written in VS 2002 which contains a
number of Crystal Reports, all of which were working fine. I had to change
the data source of 1 report from Stored Procedure A to Stored Procedure B in
my SQL Server 2000 db. Connections are made through ODBC, not integrated
security. I was able to do this without difficulty by resetting the Location
of the report source, but when I try to open the report at run-time, the
following occurs:
- prompt appears asking for db password. server name, db name, and username
are prefilled.
- when correct password entered, 'Logon Failed' message appears
- when correct password entered a second time, login box disappears and
report displays
I am logging on in code every time I load any Crystal Report, and none of the
others give me this prompt. All reports are loaded into the same report
viewer on the same page; I just have a long select case statement which
indicates which report to load. I would really appreciate any help you could
offer. Here is the complete code:
Sub PrintReport(ByVal strRpt As String, ByVal strSp As String, ByVal
ParamArray paramValues() As Object)
'Prints selected Crystal Report
'Params: 1. Name of report to print
'2. Stored Procedure to run
'3. Array of Paramater names & values
Dim objRpt As Object
Dim crTable As CrystalDecisions.CrystalReports.Engine.Table
Dim crLogonInfo As New CrystalDecisions.Shared.TableLogOnInfo()
Dim objData As New BusinessRules.CDataAccess()
Try
'1. Create selected report object
Select Case strRpt
Case "rptcarrierform"
objRpt = New rptcarrierform()
Case "rptInvoice"
objRpt = New rptInvoice()
Case "rptInvoiceCharges"
objRpt = New rptInvoiceCharges()
Case "rptCreatedInvoices"
objRpt = New rptCreatedInvoices()
If Not IsNothing(objFrm) Then
objFrm.Close()
End If
Case "rptNoInvoice"
objRpt = New rptNoInvoice()
Case "rptWSIB"
objRpt = New rptWSIB()
Case "rptManifest"
objRpt = New rptManifest()
Case "rptRunningOrder"
objRpt = New rptRunningOrder()
Case "rptBrokerage"
objRpt = New rptBrokerage()
Case "rptBrokerage2"
objRpt = New rptBrokerage2()
Case "rptMedical"
objRpt = New rptMedical()
Case "rptLicense"
objRpt = New rptLicense()
Case "rptAccruals"
objRpt = New rptAccruals()
Case "rptCancelled"
objRpt = New rptCancelled()
Case "rptInvoice2"
objRpt = New rptInvoice2()
End Select
'2. Connect to db
rptViewer.LogOnInfo = New CrystalDecisions.Shared.TableLogOnInfos
()
crLogonInfo.TableName = strSp & ";1"
objData.ReportLogin()
With crLogonInfo.ConnectionInfo
.ServerName = objData.ServerName
.DatabaseName = objData.DatabaseName
.UserID = objData.UserID
.Password = objData.Password
End With
rptViewer.LogOnInfo.Add(crLogonInfo)
'3. Add Report Parameters
SetParameters(paramValues)
'4. Bind data and display report
rptViewer.ReportSource = objRpt
rptViewer.Show()
Catch objError As Exception
CException.LogError(objError)
End Try
Me.Cursor.Current = Cursors.Default
End Sub
Private Sub SetParameters(ByVal ParamArray parameterValues() As Object)
Dim ParameterFields As CrystalDecisions.Shared.ParameterFields
Dim ParameterField As CrystalDecisions.Shared.ParameterField
Dim spValue As CrystalDecisions.Shared.ParameterDiscreteValue
Dim p As SqlParameter
Try
If Not parameterValues Is Nothing AndAlso parameterValues.Length
> 0 Then
ParameterFields = New CrystalDecisions.Shared.ParameterFields
()
For Each p In parameterValues
If (Not p Is Nothing) Then
ParameterField = New CrystalDecisions.Shared.
ParameterField()
spValue = New CrystalDecisions.Shared.
ParameterDiscreteValue()
' Check for derived output value with no value
assigned
If (p.Direction = ParameterDirection.InputOutput
OrElse p.Direction = ParameterDirection.Input) AndAlso p.Value Is Nothing
Then
spValue.Value = "NULL" 'DBNull.Value
End If
'Set parameter name & value
ParameterField.ParameterFieldName = p.ParameterName
spValue.Value = p.Value
'Add to parameter collection
ParameterField.CurrentValues.Add(spValue)
ParameterFields.Add(ParameterField)
End If
Next p
'Add parameter collection to Report Viewer
rptViewer.ParameterFieldInfo = ParameterFields
End If
Catch objError As Exception
CException.LogError(objError)
End Try
End Sub
--
Message posted via http://www.dotnetmonster.com Tag: .NET Framework 3 Tag: 104847
return value
I had this working and now it's not. I call one form from another then I
return a value to the first. I had a public sub in the parent form that the
child would call and set the variable. The value in the parent form always
ends up 0 now. Even though it appears the value the child is sending is
correct. As soon as the child form closes the value resets to zero. I'm
not sure why it was working before and now is not. Can anyone explain my
error? Tag: .NET Framework 3 Tag: 104846
get form
Hi
I have a windows application. This application opens some forms. I wold like
to get the first form (the one includes main) from the other forms and call
some functions in that form. How do I do this? I know
Thanks
Julia Tag: .NET Framework 3 Tag: 104845
DataBinding to DataGridView AND TextBoxes?
Hi,
My problem:
When the cursor is on a given row in the DataGridView, the data in the row
has to be shown in TextBoxes underneath the DataGridView. the user must be
able to edit in the Datagridview, or in the textboxes. The text in these
textboxes and the datagridview has to be synchronsied at all time. So if the
user types "a" in the Name-Column, the "a" has to appear immediately in the
Textbox etc.
This doesn't seem to be as easy as I thought. I used a BindingSource, and I
handle the EditingControlShowing_TextChanged-event of my DataGridView, and
in that handler I force commits after each keypress
(Me.dgvArticles.CommitEdit(DataGridViewDataErrorContexts.Commit) ) and do a
ResetCurrentItem of my BindingSource. But this doesn't work always, not when
it's the first time a suer selects a row etc etc etc...
So: a lot of trouble, and still not the desired result.
Does anybody knows how to do this? I would help me really a lot!
Thanks a lot in advance,
Pieter Tag: .NET Framework 3 Tag: 104839
Making sure special characters display correctly
I will admit it up front, ever since some version of DOS went global, I've
gotten a headache everytime I even contemplated codepages:-)
I want to be able to display three special characters, in one case as the
password character, and in the other cases as the text on a small button in a
datagridview.
I've scanned over the postings and the recommended KB articles and if I
wanted to do a web page in Korean or process a document around in Hebrew, i
think i could do it. What I can't do is make the some simple code work:-(((
Essentially all I coded was
textbox.passwordchar = "â?º" ' character is a smiley
My stupidity was selecting a font for the dialog that did not have â?º in it.
(Verdana) Yet. it worked fine at the office. Out at the client site i got a
square box instead. I solved the problem by making sure all the relevant
controls used Arial even if the rest of the dialog was using Verdana.
So I have questions to help me understand what is going on.
My client is using XP in a Detroit suburb so there is nothing fancy going
on. What settings for the OS should I look at to see why it worked at the
office but not at their site? (Charmap for shows the stuff of interest just
fine. A test console app at their site shows the characters of interest just
fine. It's the windows app that has problems.)
I just repeated the exercise here at the office. With the font of the
textbox defaulting to verdana 9 pt - as confirmed by a msgbox display of the
font name - i get some appropriately scrunched up smiley face as I type. With
the font set at Arial 11 i get a big bold face as I type. QUESTION: What
mechanism is causing Framework to display a character that isn't in the font,
i.e. the scrunched smiley when the font is set to Verdana?
It gets even weirder. With the font set to verdana, i turned the password
character off (there is a check box for that, something I wish all programs
provided for the mornings we aren't typing quite right:-). Then I copied some
Hebrew off charmap and pasted it into the textbox. It worked! I copied â?²â?ºâ?¼â??
and got the phenomenon I'm seeing here. The Up and Down arrows are in one
size and the left and right in a different size. QUESTION: What is going on
here?????
--
Regards,
Al Christoph
Senior Consultant
Three Bears Software, LLC
just right software @ just right prices @ 3bears.biz
Microsoft Certified Partner (ISV)
Coming soon: Windows Mail tools for Vista. Tag: .NET Framework 3 Tag: 104838
ReportViewer... "the handle is invalid"
Hi all,
Posting this again using my shiny new posting alias (so an MS representative
will respond).
Using the 2.0 framework (no hotfixes) I'm trying to print a report without
previewing it. The code looks like:
public partial class fErrors : Form
{
private DataImportServices.ImportError[] _Errors;
public fErrors()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ImportErrorBindingSource.DataSource = _Errors;
reportViewer1.RefreshReport();
}
private void reportViewer1_RenderingComplete(object sender,
RenderingCompleteEventArgs e)
{
//
// Report finished let the user choose a printer
//
reportViewer1.PrintDialog();
}
}
The report viewer is initialized as follows:
reportDataSource1.Name = "DataImporter_DataImportServices_ImportError";
reportDataSource1.Value = this.ImportErrorBindingSource;
this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1);
this.reportViewer1.LocalReport.ReportEmbeddedResource =
"DataImporter.rErrorsList.rdlc";
this.reportViewer1.Location = new System.Drawing.Point(251, 11);
this.reportViewer1.Name = "reportViewer1";
this.reportViewer1.Size = new System.Drawing.Size(149, 28);
this.reportViewer1.TabIndex = 3;
this.reportViewer1.Visible = false;
this.reportViewer1.RenderingComplete += new
Microsoft.Reporting.WinForms.RenderingCompleteEventHandler(this.reportViewer1_RenderingComplete);
Roughly speaking the report is just a simple listing of errors... a line
number and error message/description (the errors just happen to be returned
by a webservice... but I don't think that is related to the problem).
When I click the print button (button1) I'm prompted with the select printer
dialog, I do not change anything... just click print (I have a default
printer, a Dell 1710n, Adobe PDF, and a fax printer). The processing dialog
appears... and then boom an exception.
The specific exception is:
System.Reflection.TargetInvocationException was unhandled
Message="Exception has been thrown by the target of an invocation."
Source="mscorlib"
StackTrace:
at System.RuntimeMethodHandle._InvokeMethodFast(Object target,
Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target,
Object[] arguments, Signature sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at
System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry
tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object
obj)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at
System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&
msg)
at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at DataImporter.fMain.cmdImport_Click(Object sender, EventArgs e) in
...\My Documents\Visual Studio
2005\Projects\DataImporter\DataImporter\fMain.cs:line 564
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&
msg)
at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at DataImporter.Program.Main() in ...\My Documents\Visual Studio
2005\Projects\DataImporter\DataImporter\Program.cs:line 21
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
The inner exception is:
System.ComponentModel.Win32Exception "The handle is invalid",
Error code: -2147467259
Source: System.Drawing
Stack trace:
at
System.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocument
document, PrintEventArgs e)
at
System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocument
document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at Microsoft.Reporting.WinForms.ReportViewer.PrintDialog()
at DataImporter.fErrors.reportViewer1_RenderingComplete(Object sender,
RenderingCompleteEventArgs e) in ...\My Documents\Visual Studio
2005\Projects\DataImporter\DataImporter\fErrors.cs:line 80
at
Microsoft.Reporting.WinForms.ReportViewer.OnRenderingCompleteUI(ProcessThreadResult
result, PostRenderArgs postRenderArgs)
and Target site is :
{Void OnStartPrint(System.Drawing.Printing.PrintDocument,
System.Drawing.Printing.PrintEventArgs)}
This exact error condition is also mentioned in the following posts:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=541808&SiteID=1
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=216364&SiteID=1
http://groups.google.sm/group/RS2005/browse_thread/thread/ac870db0bf8cc3db/548ad83c984f3192?hl=it#548ad83c984f3192
One of the posts seemed to suggest the problem might be printer model
specfic... so I tried printing to the Adobe PDF "printer"... worked like a
charm.
So... is this a known problem with the reportviewer? Is there any
workarounds? Is there anything I can do to help pin the problem down
further?
Regards,
Rob M.
--
rmacfadyen@nospam.nospam Tag: .NET Framework 3 Tag: 104836
Best Practice from Oracle DB to DataGridView
Hi,
I'm wondering whats the best practice to accomplish the following
display in a DataGridView.
1. Perform a Query to an Oracle DB with a multiple join select that
returns multiple rows. (Should I use a DB object i.e. Stored Procedure,
Function, View, or nothing)
2. Bind the rows/data to a DataGridView via DataAdapter or
DataTable/Set.
What is most people/the best practice for doing the listed? I heard
using ref Cursors but they cause headaches. Is there a practice that
allows me to do everything via the VS2005 IDE?
Thanks in advance.
Newton Tag: .NET Framework 3 Tag: 104834
Publishing from a ClickOnce deployment project
How do you publish from a deployment project? I know how to publish from the
solution (right-click select publish and use the publish wizard) but now I
want to do the same steps automatically in a deployment project. If I need
to use a custom action, what do I actually need to do within the custom
action to get the application to publish. Tag: .NET Framework 3 Tag: 104826
ComboBox binding to subset of another ComboBox
This is for a Windows Forms application...
I am wanting to set up binding once, if possible, for a second combobox that
contains filtered data based on the first.
I know I can capture the event of the first combobo and then bind the second
based on the value, but was hoping that there is an easier/better way.
Here is the scenario
class Car
{
Guid carID;
int year;
string carName;
}
class Manufacturer
{
Guid id;
string name;
List<Car> cars;
}
class MyCollection
{
List<Manufacturer> makers;
}
private void MyControl_Load( object sender, EventArgs e )
{
cboMaker.DisplayMember = "Name";
cboMaker.ValueMember = "ID";
cboMaker.DataSource = makers;
cboCar.DisplayMember = "CarName";
cboCar.ValueMember = "CarID";
cboCar.DataSource = ??? <<<<<<<<<<<<<<<<
}
Thanks,
Dave Tag: .NET Framework 3 Tag: 104818
Tooltip in TreeView control
Hi,
I have a TreeView control in my project (I am working with VS2003, C#).
I also have a tooltip attached to it, which I use to display special
information once user places (MouseMove) the mouse on a TreeNode.
The TreeView control has a basic behaviour that once a TreeNode text
(name) exceeds the size of the control, a tooltip is displaying the
TreeNode text (name). now I have two tooltips showing:
1. treenode text (name).
2. my special information.
My aim is to prevent the first tooltip from showing. I tried to
override WndProc() in the following way:
protected override void WndProc(ref Message m)
{
if(m.Msg == TTN_SHOW)
{
//ignore tooltip show message
return;
}
base.WndProc (ref m);
}
IT DID NOT WORK!
I defined TTN_SHOW to be (found it in commctrl.h):
TTN_FIRST = (0U-520U)
TTN_SHOW = (TTN_FIRST - 1)
Apperantly this is not the message the control receives :(
could somone explain why? Tag: .NET Framework 3 Tag: 104816
About maximizing the forms into the task bar.
Hi all,
I am doing an desktop application in vb.net. For forms i have used the
property formborderstyle=none. So what happens when i minimize the form into
the task bar,and again right click on the form i could not the maximize or
minimize or restore. So please let me know how to do this.
--
Regards,
Ravindra P.N Tag: .NET Framework 3 Tag: 104814
Display of tab control pages
I know how to stop a user selecting a different tab page (see Disable tab
control pages in this newsgroup). Can I also change the text colour of the
tab page header so that it appears 'disabled'? I can only find colour
properties for the tab page itself.
--
Steve Tag: .NET Framework 3 Tag: 104810
DataGridView - How to disable jumping on next row on Hit ENTER?
Hello,
I have problem, on modal dialog, user has to select one value from
DataGridView. AcceptButton is set on Form, but DataGridView jump on next row
on user Enter, so wrong row is selected.
Any suggestion how to disable jumping to next row when user hit Enter button?
Thanks
MilanB Tag: .NET Framework 3 Tag: 104805
Weird MDI Issues
Hi
I have the problem that my C# MDI application shows the default VS icon
instead of the child window icon next to the menu bar if the child window is
maximized from the beginning.
I have found a thread from 2003 describing this exact same problem
(http://groups.google.dk/group/microsoft.public.dotnet.framework.windowsforms/browse_thread/thread/79b2c2a015e01f0f/4978aa6b78d60cf6?lnk=st&q=%22Weird+MDI+Issues%22&rnum=1&hl=da#4978aa6b78d60cf6).
In the thread Ying-Shen Yu from Microsoft acknowledge the problem and writes
that this will be solved in the next version of VS.
The problem is that I am using VS 2005 which must be "the next version of
VS" as the answer from mr. Yu was written in 2003.
So what has happened to this bug-report - has it simply been ignored?
/Peter
Btw: The work-around of setting the WindowState after calling Show()
suggested by mr. Yu still works even though it is not very elegant (you can
see the window being maximized). Tag: .NET Framework 3 Tag: 104804
Disable tab control pages
Is there a way to stop a different tab control page from being selected
without disabling the entire tab control? (The user needs to be able to use
the controls on the tab page but shouldn't be able to select a different tab
page). If I can stop the selectedindexchanged event from bubbling up I think
that would work but e.Handled doesn't exist for the EventArgs that are used
by this event. Is there another way to stop the event bubbling up higher than
my SelectedIndexChanged event handler?
--
Steve Tag: .NET Framework 3 Tag: 104803
Throwing exception in ComponentRemoving event handler
(I had posted this over on
microsoft.public.dotnet.framework.windowsforms.designtime but it didn't see
any action, so we'll try microsoft.public.dotnet.framework.windowsforms now)
I have a control that I don't want the user to be able to remove. Thus, I
was going to use the ComponentRemoving event to prevent the control from
being removed. According to the docs:
"This event occurs during unload and when the user deletes a component. You
can cancel the process of removing a component by throwing an exception
here."
However, if I throw an exception from the event handler, visual studio gives
a nasty little error message box, and if I use the control in my own
designer host, I get a really nasty unhandled exception. True, the control
doesn't get removed which is a good thing, but the user experience is
unpleasant to say the least. Is there anyway to silently prevent a control
from being removed from a designer? Am I just throwing the wrong exception
in the ComponentRemoving event handler? Tag: .NET Framework 3 Tag: 104801
Prevent control from being dragged off
(I had posted this over on
microsoft.public.dotnet.framework.windowsforms.designtime but it didn't see
any action, so we'll try microsoft.public.dotnet.framework.windowsforms now)
I have a custom Control that uses a custom Designer that inherits from
DocumentDesigner. The designer is specified using the DesignerAttribute on
the custom Control. On this control, I would like to prevent controls from
being dragged off of the surface. Unfortunately, there is no
OnQueryContinueDrag with which I can use to cancel the drag operation once
the control hits the edge of the surface. Does anyone have any advice on
how I might be able to accomplish this goal? Is it even possible to prevent
a control from being dragged off the parent's surface? Tag: .NET Framework 3 Tag: 104800
How to set the BackColor of a single item in ListBox
I mean, I only wanna change the BackColor of some items in a ListBox,
not the whole background color. The items are type of ObjectCollection,
so it looks like no way to do so.
Can someone explain how to? thx in advance. Tag: .NET Framework 3 Tag: 104799
VB to C# issue
Hi,
im converting a VB web app to a C#.
i have problem with the following line
ds.Tables[0].Rows[ind].Item["taskid"]
ERROR - 'System.Data.DataRow' does not contain a definition for 'Item'
whats the alternate that i can use?
please let me know
Thanks Tag: .NET Framework 3 Tag: 104797
Drag Drop
Hallo Net-Gruppe,
bin schon l=E4nger auf der Suche nach der L=F6sung f=FCr folgendes
Problem:
Ich hab eine VB.Net-Anwendung programmiert, die per Drag/Drop Dateien
vom Explorer entgegennimmt. Ich w=FCrde die Anwendung gerne unter einem
bestimmten User laufen lassen, um bestimmte Verzeichnisse zu sperren.
Dann funktioniert aber Drag/drop nicht mehr.
Bei anderen Anwendungen, z.B. Excel, ist das m=F6glich.
Kann mir da jemand helfen?
Danke
Reinhard Tag: .NET Framework 3 Tag: 104796
a ListBox issue
Hi
I have a COM DLL which has a method that adds an item into a client -
provided listbox given the listbox handle (using Win32 SendMessage) -
Something like (pseudocode)
void AddItem (HWND clientHandle)
{
char sText[] = "blahblahblah";
SendMessage(clientHandle, LB_ADDSTRING, 0,(LPARAM) sText);
int iCur = SendMessage(clientHandle, LB_GETCOUNT, 0,0);
SendMessage(clientHandle, LB_SETCURSEL , iCur-1, (LPARAM) 0);
.....
}
I have a C# client that has a list box on it. When I use AddItem, the
item is actually added in the listbox (I can see it). However, the
IistBox.Items.Count does not change (it is still 0) and if I try to use
something like
listbox.SelectedIndex = 0
or access the Items somehow, I get ArgumentOutOfRangeException
(because Items collection still shows no elements).
I tried different settings but with no success.
Any ideas?
Thanks.
Ivan Tag: .NET Framework 3 Tag: 104795
FileDialog AddExtension bug?
I've got SaveFileDialog.AddExtension set to True.
I've got SaveFileDialog.Filter set to "JPG Image (*.jpg)|*.jpg|PNG Image
(*.png)|*.png"
If I invoke this dialog and type a file name like "test file.whatever" the
dialog does not append the extension for the currently selected filter
(.jpg or .png). It assumes the ".whatever" is the extension.
Shouldn't it detect that ".whatever" isn't one of the extensions in the
filter and add the currently selected extension to the returned filename?
Joel Moore Tag: .NET Framework 3 Tag: 104793
Tree View
Could you please let me know the best approach to create something like the
visual studio watch window, ie a tree view combined with a list view.
it may be you have created this from scratch, but has any one an example. Tag: .NET Framework 3 Tag: 104792
displaying russian in a richTextBox (C#)
Hi all,
I'm trying to display a russian text (which is read from a ressource
file) in a richtextbox.
The text is always displays like "???" and i cannot find the correct
header to write in the .Rtf property of my control.
Could someone indicate me a method to pass over my problem ? :)
Thanks in advance
Nicolas Tag: .NET Framework 3 Tag: 104788
Multiple DataGridView same Form different CurrencyManager
hi, i'm trying to use multiple datagridview controls on one form, that are
connected to the same datasource,
but each displays a different view of the same table, my problem is that
every grid displays the same data ,
no matter if i used a different bindingsource for each one, and inside each
bindingsource i entered a different filter.
i guess it is because the all use the same currency manager or somthing like
that, does anybody knows how to resolve this issue?
thanks in advance Tal. Tag: .NET Framework 3 Tag: 104786
How do I change font when using Index in the help menu
Hello!
I have installed Visual Studio .NET 2003 but when I use for example index in
the Help menu for class Form it display a very small and strange font. It's
hardly readable.
Does anybody have any idea how I can change the font so it will be readable.
Is this some kind of settings that is done in Windows perhaps.
I have never had problem with this before.
There is for example no View with TextSize that I can change.
//Tony Tag: .NET Framework 3 Tag: 104780
Sorting problem in datagridview + vb .net 2005
Hi all,
I have a datagridview which is having 100 rows , at a time 25 rows is
shown in the datagridview , but in some other case i have less than 25
rows , that time i add the blank rows ( 25- filled rows count) , but if
i do assending sort , the blank rows are brought up , for the look and
feel i have done this adding blank rows.
How can i prevent this
Thanks in advance
Sajin Tag: .NET Framework 3 Tag: 104779