Unrepeatable form bugs -- Is 100% managed .Net Stable?
I am getting the following UNREPEATBLE symptoms on my 100% managed
application:-
- Form will not close via window close button. Need to Application.Exit().
- Keyboard events lost, cannot access the menus with Alt-
- Null pointer exceptions deep within the Windows runtime.
- TextBox OnValidated events stop firing after a while. OnLeave still
works.
Something is destabalizing the entire system. Feels like the bad old days
of C++, eg. a corruped pointer. But that should not happen in .Net. Has
anyone had similar problems?
The application is very simple, with only one main form, only one thread.
One complication is that it uses a Model-View-Controller approach and if the
model changes too much I just recreate the guts of the form from scratch.
The form has a TabControl which is permanent. But I periodically
TabControl.Clear() and then recreate all the tab pages. I have not bothered
removing the individual controls on the page before the .Clear(), I would
expect this to recurse automatically.
I have created a small dummy TextBox on the main form, and I send the focus
their before doing a Clear. This seems to reduce the crashes. But one
problem -- the textbox sometimes refuses to accept focus for no apparent
reason.
This is worrying. One can waste a lot of time hacking around buggy systems
changing things in the hope that the bugs will disapear. Not having the
.Net sources is also a worry -- I don't want to have to read them but in the
event of a crash they are handy. Maybe we should have used Java.
Regards,
Anthony Tag: CheckedListBox ... Tag: 53463
What is the proper way to cancel the closing of a MDI application?
Hi,
I have an MDI application. If the user presses the close button (the X in
the upper right), I need to check each child form and see if it is dirty and
give the user an opportunity a) lose their changes, b) save changes and
continue closing, or c) abort the close action. I have code that presents
these choices and does the correct thing from the MDI child's point of view,
but I am search for a mechanism for notifying the MDI parent that a child
has aborted the close. So far my code looks like:
Private Sub myApp_Closing(byVal sender as object, byVal e as
System.ComponentModule.CancelEventArgs) Handles MyBase.Closing
Dim frm as form
for each frm in me.MdiChildren
frm.close()
next
End sub
I suppose I could add some global that I check each time in the loop, but I
thought that Windows.Net had a better mechanism.
Any thoughts?
Thanks,
Jerry Tag: CheckedListBox ... Tag: 53462
Patial Undo Disaster
Using VS 2003, VB.NET..
There is a disastrous bug in the "undo" icon that cost me a lot of work...
I had a data grid with an intricate collection of GridColumnStyles (i.e.
created via properties, DataGridTableStyles Collection). I accidentally
deleted the DataGrid in the WinForm, and immediately pressed the Undo icon
which restored it and the DataGridTableStyles. To my horror, I realized
later, it did not restore the GridColumnStyles collection at all - it was
completely lost.
If undo does not completely undo an action, it should warn you.
Very frustrating... How do we know when undo completely works and when it
only partially works?
Bob Day Tag: CheckedListBox ... Tag: 53461
DataGrid questions
using VS 2003, Vb.net...
In a WinForm, I have a datagrid with a parent child relationship named
"Display Details". When you click on the + next to the Parent row, below it
you get "Display Details" -
when you click on that, you get the related child rows of the Parent row.
Everything
displays correctly.
The parent row represents a telephone line (1,2,3 etc) and the child row
represents what is happening real time on that line (Parent Line 1, Child
Row 1 - Playing Greeting, etc.). So rows are constantly being added to the
child rows (i.e. the dataset) (whether displayed or not).
Question 1 - The "Display Details" seems non-standard windows programming.
When you click a + next to an item, you expect to expand what ever is under
it. Is there any way to get rid of the "Display Details" and just
automatically expand to the child rows? There is only this one relation in
the collection.
Question 2 - I would expect "if mygrid.isexpanded(0) = true" to tell me that
the datagrid for row 0 is expanded and the child rows are displayed. It
does not.
It only tells me that "Display Details" is visible or not. Toggling
mygrid.expanded and mygrid.collapsed. simply displays or doesn't display the
"Display Details" option. This is pretty useless. How can I determine if a
Parent row is displaying the child rows or not?
Question 3 - With a Parent row expanded to display child rows, how do I
modify the Parent row? You would think that simply modifying the
corresponding DataSet column value would accomplish this, but this generates
an error that I cannot make sense out of. How do you update a Parent Row
while it is expanded shows related child rows?
Question 4 - Updating a Parent row column value(not a column used in
creating the parent/child relationship) seems to always collapse the child
rows for that parent row. Is there a way around this?
Question 5 - Adding child rows to the DataSet does not display them in the
datagrid if the screen is already full with previously child rows. You can,
of course, scroll down to see it. How would you make the last child row
added visible?
Thanks for your help.
Bob Tag: CheckedListBox ... Tag: 53460
Automating Word
I have managed to automate word with a template of my
choice in C# but what I want to do is for particular
things to happen in my code after the word document is
saved and nothing to happen if the document is not saved.
Is it possible to do this using the interop assemblies,
C# and Word? Tag: CheckedListBox ... Tag: 53441
override datagrid cell context menu?
My datagrid context menu does not display if the cursor is
within a cell or the cell text is selected... instead the
standard cut/copy/paste menu is displayed. how do I get
my menu to always show up?
thanks a bunch
mike Tag: CheckedListBox ... Tag: 53434
Sending a custom Windows message
Hi,
can anybody tell me if there is a way to define and send a custom windows
message to a window and to specify
a handler function for it in C#?
The reason I'm asking this is following - I use some 3d party component that
start its own threads. When my
command is executed by this component it invokes my callback in the context
of its thread. But
I need to somehow update my GUI after that. I can't access my GUI controls
from this callback (get an
exception - wrong thread or something like that), so I thought that if I
could place a message into my app's
message queue then I could handle this situation properly.
Thanks in advance!
Regards,
Dmitry. Tag: CheckedListBox ... Tag: 53428
clear all errors with ErrorProvider
I want to use a single ErrorProvider for my entire form by adding
control/error combinations using:
myErrorProvider.SetError(textBox1, errorMessage1);
myErrorProvider.SetError(textBox2, errorMessage2);
This works with no problems. However, I want to be able to easily
clear *all* errors that the provider is bound to. I realize that I
can set do this via the following:
myErrorProvider.SetError(textBox1, "");
myErrorProvider.SetError(textBox2, "");
...but since there will be a lot of controls on the page I'm hoping
there's some way to simply clear all.
myErrorProvider.Clear(); //alas, i know this doesn't exist...
anyone have any suggestions?
TIA Tag: CheckedListBox ... Tag: 53427
Problem with the navigation in a tree view menu
Hello, i have an application developed in C# .NET, it has
a main window where is the tree view menu and it has
several options, and when i'm navigating through the
options suddenly i get an exception that says: "Exception
has been thrown by the target of an invocation object"
I hope you can help me to fixed this kind of error...
Thank you.... Tag: CheckedListBox ... Tag: 53425
ListView Questions
After i populate a listview how can i manually selected an item.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! Tag: CheckedListBox ... Tag: 53424
Performance issue: integrating WinForm app with legacy COM DLLs
We've noticed that invocations of legacy C++ COM DLLs from .NET (Managed C++
or C#) desktop applications is quite a bit slower than the same calls from
good old native C++.
Does anybody have specific information about why this would be the case?
How about performance numbers, benchmarks, etc? Any suggestions to speed up
the connection between new .NET code and legacy C++?
Thanks for your help -
Steve Tag: CheckedListBox ... Tag: 53417
2nd Repost: Problem Retrieving DataSet Returned By A WebService... anyone from Microsoft or anyone with solution?
Hi,
I'm working on a project which includes WebServices and Windows Form
application.
The Windows Form application will call the WebServices to retrieve data from
database. The data will be returned as DataSet.
Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset
returned contain errors (marked by calling the SetColumnError() method or
setting the RowError property of the DataRow), I get the following error
message in the Windows Form application,
"There is an error in XML doument (1,xxxxxxx)"
If I forced the Windows Form application to run on .NET Framework 1.0,
everything works fine.
Is this a bug? Or I need to make some code adjustment because of changes to
the Framework?
Here's the partial code for the WebService project
Code:
<WebMethod()> _
Public Function RetrieveDataSet() As DataSet
Dim ds As New DataSet
Dim dt As New DataTable
Dim row As DataRow
Dim i As Integer
dt.TableName = "TestTable"
dt.Columns.Add("TestColumn1", GetType(String))
dt.Columns.Add("TestColumn2", GetType(Integer))
ds.DataSetName = "TestDataSet"
ds.Tables.Add(dt)
For i = 0 To 10
row = dt.NewRow
row("TestColumn1") = "This is row " & i
row("TestColumn2") = i
dt.Rows.Add(row)
' The following code trigger the error after the DataSet
' is returned to the calling Window Form application
row.SetColumnError("TestColumn1", "Error message here")
Next
Return ds
End Function
For the Windows Form application, you need to insert a datagrid control
(assumed as datagrid1). It will look something like this,
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim ws As localhost.Service1
Dim ds As DataSet
Try
ws = New localhost.Service1
ds = ws.RetrieveDataSet
Me.DataGrid1.SetDataBinding(ds.Tables(0), "")
Catch ex As Exception
MsgBox(ex.Message)
Finally
If (Not (ws Is Nothing)) Then
ws.Dispose()
End If
End Try
End Sub
I really hope someone could help me out with this one.
Thanks in advance.
ps: Please, before anyone reply to state that I did not choose the
appropriate groups when making this post a crossposts post, please know that
I'm currently in blind on what is causing this error. Is it the WebService?
or is it the ADO .Net? or is it Windows Form application? or is it VB .Net?
Well, it has something to do with WebService as it only happens to the
DataSet returned by WebService. It also has something to do with ADO .Net as
I'm using DataSet. And it definitely has something to do with Windows Form
application as if I force the Windows Form application project to run on
.Net Framework 1.0, everything works fine. Tag: CheckedListBox ... Tag: 53416
override DataGrid.BeginInit ()
I need to override DataGrid.BeginInit() (and DataGrid.EndInit()). They are
inherited from the interface ISupportsInitialize.
Here's how the documentation declares BeginInit:
public virtual void BeginInit();
But when the following code:
public class MyDataGrid : DataGrid {
public override void BeginInit () {}
}
produces this compiler error:
'MyDataGrid.BeginInit()' : cannot override inherited member
'System.Windows.Forms.DataGrid.BeginInit()' because it is not marked
virtual, abstract, or override
What am I missing?
Thanks!
Kristin Tag: CheckedListBox ... Tag: 53414
Delete Datgrid's Last Row, Click on the grid again, Get the Exception.
Hi All,
I am using a custom collection (inherits collection base) and set it
as the datasource of the Datagrid. Everything works great except when
I delete the last row. WHEN I CLICK ON LAST ROW ON THE GRID IT GIVES
THE FOLLOWING ERROR :
"An UNHANDLED exception has occured in your application.If U click
Continue ,the application will ignore the error and attempt to
continue. If u click quit , the application will be shut down
immediately. Index was outside the bounds of the array!."
The title of the messagebox is 'error when committing the row to the
original datastore'. Im wondering how its going to commit the row to
the original datastore when its a custom collection of software
objects???
THE BUG happens EXCATLY when I delete the LAST ROW in the grid then
try to click anywhere in the grid!.
private void btnDeleteReference_Click(object sender, System.EventArgs
e)
{
if(referenceCollection.Count>0)
{
if(dgReferences.CurrentRowIndex >=0)
{
referenceCollection.RemoveReferenceAt(dgReferences.CurrentRowIndex,App.Connection
);
//dgReferences.CurrentRowIndex=0;
dgReferences.DataSource = null;
dgReferences.DataSource = referenceCollection;
dgReferences.Refresh();
//int i= referenceCollection.Count-1;
try
{
this.dgReferences.CurrentRowIndex = 0;
}
catch(Exception exxx){}
//dgReferences.CurrentRowIndex = referenceCollection.Count-1;
}
}
}
I've tried with several combinations of assigning a valid integer to
CurrentRowIndex ptoprty of the grid (Commented lines) to avoid the
error. Still it throws the exception telling Invalid index, index
should be non-negative or less than the bounds of the collection. I
tried to catch the exception while assiging an integer to the
currentRowIndx property, then too, exception is thrown by the
Application's Main form, parent of my Form.
What is this???
I found somewhere on the NET that this is a bug in MS Datagrid. But
the worst thing is that even the SelectedIndex property is failing to
work.
I AM REALLLY FRUSTRATED!!
Please help me out! :-(
Thanks in advance,
Sheetal Tag: CheckedListBox ... Tag: 53405
TabControl & ComboBox
Need to have same ComboxBox in two Tab Pages of a Tab
Control so that both pages would exhibit same behavour for
Combo events.
Modifying the InitializeComponent() to add the combo to
both the pages did not work. However dynamically adding
the Combo to the selected page on
tabControl1_SelectedIndexChanged event worked. Is this the
right approch?
Can I have two seperate combo and sort of set one equal to
the other so that both Combos exhibit same behaviour for
its events with out duplicating the code (event handlers
etc)
Thanks,
Rajesh Abraham Chacko Tag: CheckedListBox ... Tag: 53400
problem with bring to front
Hello,
I want to create a panel in a groupBox. My panel is larger
than the groupbox. I want to use a vscrollBar to navigate
into my panel. But when I use my vscrollbar, my panel
design is above my groupbox. I try to use the bringToFront
function but it seems to not work with childrens.
Does anybody could help me? Tag: CheckedListBox ... Tag: 53399
OnResize and OnSizeChanged
This is a multi-part message in MIME format.
------=_NextPart_000_006F_01C35826.3D8DCA90
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
What is the differnce between OnResize and OnSizeChanged events in =
windows forms.
Thanks
Rajeev
------=_NextPart_000_006F_01C35826.3D8DCA90
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD><FONT face=3DVerdana><FONT size=3D2>
<BODY>
<DIV>Hi,</DIV>
<DIV> </DIV>
<DIV>What is the differnce between OnResize and OnSizeChanged events in =
windows=20
forms.</DIV>
<DIV> </DIV>
<DIV>Thanks</DIV>
<DIV>Rajeev</DIV></BODY></HTML></FONT></FONT>
------=_NextPart_000_006F_01C35826.3D8DCA90-- Tag: CheckedListBox ... Tag: 53387
How Do I Capture Mouse Wheel Movements?
I have a Microsoft wheel mouse. When focus is on a scrollable panel, I
would like to capture mouse wheel movement events to make the panel scroll
as the wheel is turned.
I don't see a mouse wheel event in the Windows.Forms.Control or panel
control.
Is there a way I can capture this in .NET?
Thanks.
Tony Lin
Fremont, CA Tag: CheckedListBox ... Tag: 53385
Making An AltTab Program/Task Switcher
Hi guys, just like to ask how do I go about making a task switcher?
Specifically I'd like to know what are the actual WindowStyles and
WindowStyleEx I should look for to determine wheter or not to include it in
the list.
I've already done the EnumWindows bit, excluded all the blank title, and
invisible windows.. but I'm still getting duplicates.. like VS .Net which
has a main window.. and a Hidden window?
There was supposed to be an article in MSDN I guess but it's not there
anymore
Thanks In Advance Tag: CheckedListBox ... Tag: 53383
An If Then but Different
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C357A7.083398E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
All,
I am trying to calculate an if statement base of a value of 12 =
multiplier. I'd much rather not have to type this all the way up for 60 =
years. How can I turn my if statement into something like If Period =
=3D 12 or multiplier of 12 then?
For Period =3D 1 To TotPmts
'My period Work
If Period =3D 12 Or Period =3D 24 Or Period =3D 36 Or Period =
=3D 48 Or Period =3D 60 _
Or Period =3D 72 Or Period =3D ...........Then
End If
Next Period
Thanks,
Brian P. Hammer
------=_NextPart_000_0008_01C357A7.083398E0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>All,</DIV>
<DIV> </DIV>
<DIV>I am trying to calculate an if statement base of a value of =
12=20
multiplier. I'd much rather not have to type this all the way up =
for 60=20
years. How can I turn my if statement into something like If =
Period=20
=3D 12 or multiplier of 12 then?</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> For Period =3D 1 To=20
TotPmts<BR>'My period Work</DIV>
<DIV> =
If=20
Period =3D 12 Or Period =3D 24 Or Period =3D 36 Or Period =3D 48 Or =
Period =3D 60=20
_<BR> =
Or=20
Period =3D 72 Or Period =3D ...........Then<BR></DIV>
<DIV> =
End=20
If<BR><BR> Next =
Period<BR></DIV>
<DIV><BR>Thanks,<BR>Brian P. Hammer</DIV></BODY></HTML>
------=_NextPart_000_0008_01C357A7.083398E0-- Tag: CheckedListBox ... Tag: 53380
Could not instantiate ActiveX control because the current thread is not in a sin
Hi,
I have a .NET .DLL called by a VB6 EXE. The following
error message is when trying to instantiate a form in
the .NET .DLL:
Could not instantiate ActiveX control 'c932ba85-4374-101b-
a56c-00aa003668dc' because the current thread is not in a
single-threaded apartment
Some documents suggest adding <STAThread()> proceeding the
Main() method to enforce the .NET in running in the static
thread. However, there is no Main() method in
the .NET .DLL.
Any one knows how to solve this problem? Appreciated very
much. Tag: CheckedListBox ... Tag: 53375
Selecting a directory dialog
Is there anyway I can use the common dialogs
SaveFileDialog for example, to select a directory? Seems
it just opens the directory when I select it, and I don't
see any flags to turn that functionality off.
Thanks
Ray Tag: CheckedListBox ... Tag: 53367
Icons and Listviews
I've got a series of items in a listview that contain icons in the first
column. These icons are basically squares of specific colors (i.e. red,
yellow, dark gray). When one of the items is selected and subsequently
highlighted, the selected color is also applied to the icon, changing it to
dark gray. I was wondering it it were possible to allow the user to select
and highlight an item, while maintaining teh color of the icon. Or, in
other words, disable selection and highlighting on the first column. Hacks
and inelegant workarounds will also be accepted!
Thanks,
Chris Tag: CheckedListBox ... Tag: 53366
Unable to Merge Menus...
Guys,
I've created a simple MDI form with a Top-Level menu and another Form with a
Top-Level Menu. I was under the impression that their menu items were
supposed to merge when I loaded the sub-form as a child of the MDI form.
However, nothing happens. No merging takes place. I can't seem to figure
out what's going on here.
I'm using VB.NET 2003. Any help would be appreciated.
Thanks,
Mike Tag: CheckedListBox ... Tag: 53365
Transfer an event to a different control
Hi
A simple question:
I have a form with a ListBox and a RichTextBox. The user selects the
list box and types some characters. I am trapping KeyPress events on
the list box, and want to simulate having the rich text box receive
that key press, so that the characters would also appear in the text
box. I don't want to alter the text of the text box programatically
with SelectedText=, because the text box is also taking care of the
effect of backspace and other key presses.
I believe that if one control contains another, the event is passed up
the container hierarchy until it is handled, so I could set
Enabled=false. But how can I transfer the event between peer
controls, and can this be done in managed code?
Many thanks for your help,
James Carlyle Tag: CheckedListBox ... Tag: 53364
VS.NET Installer Documentation
I was wondering if there is any documentation on how to create an installer using the VS.NET Installer Project. I have played with it and understand
some. I am specifically interested in how to:
1) See if .NET is installed and install if necessary
2) See if a database is installed (MSDE) and install if necessary
3) How to create program groups and short cuts for the START Menu
4) How to see if there is a previous version of software on the machine and overwrite, not the default of uninstall and then install.
Thanks,
Dave Tag: CheckedListBox ... Tag: 53360
DataGrid row icons
Hi, is it possible to get a handle to the icons used in a datagrid row? I
want to use the same icons on a button control.
E.g. The current selected row shows as a right arrow head and a new record
shows as an asteric (*), etc.
Thanks, Graeme Tag: CheckedListBox ... Tag: 53359
DataGrid question
Hi there!!!
Is it possible to insert a button contol into the cell of the datagrid???
--
Vadym Stetsyak
PDS Tag: CheckedListBox ... Tag: 53358
resize panels smoothly
Hi,
I have a windows form with a button and 2 panels. All
Panel.Dock = DockStyle.Left
-------------
| | |
| 1 | 2 |
| | |
-------------
When I click on the button, I want panel 1 to shrink and
panel 2 to grow in width:
int i = p1.Width;
p1.Width = p2.Width;
p2.Width = i;
this.Refresh();
My question is... how to make the shrinking and growing
animation look smooth and not flickering on the monitor?
I tried to use timer, but it's completely unacceptable
for user's experience.
Please help!
Thanks,
Ching-Lung Tag: CheckedListBox ... Tag: 53355
Trying to Auto Deploy Windows App (No Luck!)
I am using a call application that has a button with the=20
following code to have the windows application sitting on=20
the web server come up.=20
Private Sub Button1_Click(ByVal sender As System.Object,=20
ByVal e As System.EventArgs) Handles Button1.Click=20
Try=20
Dim formAsm As [Assembly] =3D [Assembly].LoadFrom=20
("http://SERVER/Cusip/CusipWindows.exe")=20
Dim formtype As Type =3D formAsm.GetType
("CusipChangeWindows.Form1")=20
Dim FormObj As Object=20
FormObj =3D Activator.CreateInstance(formtype)=20
Dim Form1 As Form =3D CType(FormObj, Form)=20
Form1.Show()=20
Catch ex As Exception=20
MsgBox(ex.Message)=20
End Try=20
End Sub=20
When I press the button I get an error on the=20
CreateInstance line ("Exception has been thrown by the=20
target of an invocation"). Listed below is the code from=20
the windows application. I setup the application under=20
the inetpub/wwwroot folder and gave it script only=20
executable permission and I put the data layer dll in the=20
GAC with a strong name. I also setup the server as a=20
trusted site on my machine and changed the security=20
policy for trusetd sites to meduim using the .NET wizard.=20
I don't know what else to try to get this application to=20
run. I also ran the application right from the browser=20
without the intermediary application and I got this=20
error:=20
"An unhandled exception of=20
type 'System.Security.SecurityException' occurred in=20
IEExec.exe=20
Additional information: Request for the permission of=20
type System.Security.Permissions.SecurityPermission,=20
mscorlib, Version=3D1.0.5000.0, Culture=3Dneutral,=20
PublicKeyToken=3Db77a5c561934e089 failed."=20
Code:=20
*****************************************************=20
Imports Microsoft.ApplicationBlocks.Data=20
Imports System.Security.Principal.WindowsIdentity=20
Imports System.Configuration=20
Public Class Form1=20
Inherits System.Windows.Forms.Form=20
Private dsCusip As New DataSet=20
Private CusipTable As New DataTable=20
Private iChange As Byte=20
Private MyString As String =3D GetCurrent.Name() 'Gets the=20
windows user=20
Private User As String =3D MyString.Remove(1, 11)=20
Private configFile As String =3D Application.ExecutablePath=20
& ".config"=20
Private strConnection As String=20
Private Function SaveNewChange(ByVal OrigCusip As String,=20
ByVal NewCusip As String, ByVal effdt As Date, ByVal=20
Commnt As String) As Boolean=20
Try=20
' Set up parameters (4 input)=20
Dim arParms() As SqlClient.SqlParameter =3D New=20
SqlClient.SqlParameter(4) {}=20
arParms(0) =3D New SqlClient.SqlParameter("@OrigCusip",=20
SqlDbType.Char, 15)=20
arParms(0).Value =3D OrigCusip=20
arParms(1) =3D New SqlClient.SqlParameter("@NewCusip",=20
SqlDbType.Char, 15)=20
arParms(1).Value =3D NewCusip=20
arParms(2) =3D New SqlClient.SqlParameter("@EffDate",=20
SqlDbType.DateTime)=20
arParms(2).Value =3D effdt=20
arParms(3) =3D New SqlClient.SqlParameter("@User",=20
SqlDbType.VarChar, 15)=20
arParms(3).Value =3D User=20
arParms(4) =3D New SqlClient.SqlParameter("@Comments",=20
SqlDbType.VarChar, 2000)=20
arParms(4).Value =3D Commnt=20
Dim Reader =3D SqlHelper.ExecuteReader(strConnection,=20
CommandType.StoredProcedure, "Cusip_CusipChangeSave",=20
arParms)=20
While Reader.Read=20
MsgBox(Reader.Item("Status"))=20
End While=20
'set the changed flag=20
iChange =3D 0=20
Catch ex As Exception=20
MsgBox(ex.Message)=20
End Try=20
End Function=20
Private Sub btnSave_Click(ByVal sender As System.Object,=20
ByVal e As System.EventArgs) Handles btnSave.Click=20
If txtOrigCusip.Text <> "" And txtNewCusip.Text <> ""=20
Then=20
SaveNewChange(txtOrigCusip.Text, txtNewCusip.Text,=20
dtEffDate.Value, txtComments.Text)=20
End If=20
End Sub=20
Public Sub getChanges()=20
Dim connection As SqlClient.SqlConnection =3D Nothing=20
If iChange =3D 0 Then=20
Try=20
connection =3D GetConnection(strConnection)=20
Catch ex As Exception=20
MessageBox.Show("The connection with the database can=B4t=20
be established", "Application Error",=20
MessageBoxButtons.OK, MessageBoxIcon.Error)=20
Exit Sub=20
End Try=20
Try=20
SqlHelper.FillDataset(connection,=20
CommandType.StoredProcedure, "Cusip_PamCusipChanges",=20
dsCusip, New String() {"Cusips"})=20
CusipTable =3D dsCusip.Tables("Cusips")=20
DataGrid1.DataSource =3D dsCusip.Tables("Cusips")=20
'set the changed flag=20
iChange =3D 1=20
Catch ex As Exception=20
MsgBox(ex.Message)=20
End Try=20
End If=20
End Sub=20
Private Sub TabControl1_Click(ByVal sender As Object,=20
ByVal e As System.EventArgs) Handles TabControl1.Click=20
Dim i As Int32 =3D TabControl1.SelectedIndex=20
If i =3D 1 Then=20
getChanges()=20
End If=20
End Sub=20
Private Sub btnDelete_Click(ByVal sender As=20
System.Object, ByVal e As System.EventArgs) Handles=20
btnDelete.Click=20
Dim connection As SqlClient.SqlConnection =3D Nothing=20
Dim ErrorMsg As String=20
Try=20
connection =3D GetConnection(strConnection)=20
Catch ex As Exception=20
MessageBox.Show("The connection with the database can=B4t=20
be established", "Application Error",=20
MessageBoxButtons.OK, MessageBoxIcon.Error)=20
Exit Sub=20
End Try=20
'Create the command that will be used for insert=20
operations=20
Dim insertCommand As SqlClient.SqlCommand =3D=20
SqlHelper.CreateCommand
(connection, "Cusip_CusipChangeSave", "OrigCusip", "NewCus
ip", "EffDate", "User", "Comments")=20
'Create the command that will be used for update=20
operations=20
Dim updateCommand As SqlClient.SqlCommand =3D=20
SqlHelper.CreateCommand
(connection, "Cusip_UpdateCusipChanges", "ID")=20
'Create the command that will be used for delete=20
operations=20
Dim deleteCommand As SqlClient.SqlCommand =3D=20
SqlHelper.CreateCommand
(connection, "Cusip_DeleteSingleCusip", "ID")=20
Try=20
'Update the data source with the DataSet changes=20
SqlHelper.UpdateDataset(insertCommand, deleteCommand,=20
updateCommand, dsCusip, "Cusips")=20
MsgBox("Data Saved")=20
Catch ex As Exception=20
MsgBox(ex.Message)=20
Catch concurrencyException As DBConcurrencyException=20
MessageBox.Show("A concurrency error has ocurred while=20
trying to update the data source", "Application Error",=20
MessageBoxButtons.OK, MessageBoxIcon.Error)=20
ErrorMsg =3D "The following rows weren=B4t updated: "=20
Dim currentRow As DataRow=20
For Each currentRow In CusipTable.Rows=20
If currentRow.RowState <> DataRowState.Unchanged Then=20
ErrorMsg +=3D Environment.NewLine & "Product ID: " &=20
currentRow("ProductID").ToString() & _=20
" Product Name: " & currentRow("ProductName").ToString()=20
End If=20
MsgBox(ErrorMsg)=20
Next=20
Finally=20
'set the changed flag=20
iChange =3D 0=20
End Try=20
End Sub=20
Private Sub CreateReport(ByVal QueryType As String)=20
MsgBox(strConnection)=20
End Sub=20
Private Function GetConnection(ByVal connectionString As=20
String) As SqlClient.SqlConnection=20
Dim connection As New SqlClient.SqlConnection
(connectionString)=20
connection.Open()=20
Return connection=20
End Function=20
Private Sub Form1_Load(ByVal sender As Object, ByVal e As=20
System.EventArgs) Handles MyBase.Load=20
strConnection =3D ConfigurationSettings.AppSettings.Get
("ConnectionString")=20
End Sub=20
End Class=20
**********************************************************
**************** Tag: CheckedListBox ... Tag: 53353
program exited without throwing any exception
We have upgraded the VB6 application to VB.NET. The
application uses Crystal Reports 9.0 (Advanced) for
reports, it also has MSFLEXGRID of VB6. If we switch to
another application by pressing ALT+TAB, the .NET
application exits without generating any errors. It says "
The program xxx "has exited with code 0"" Tag: CheckedListBox ... Tag: 53350
Making control size fixed (like PictureBox.SizeMode)
How can I make my control have a fixed size?
I want it to act exactly like the PictureBox control does
when SizeMode is set to AutoSize.
Thanks! Tag: CheckedListBox ... Tag: 53348
WebBrowser ctrl: switch off context menu in C#?
Hi,
I am using the AxSHDocVw.AxWebBrowser
web browser control in my windows forms
application in C# and I would like to
switch off the context menu of the browser.
Currently, I only found a solution for c/c++:
It seems that one has to implement the
IDocHostUIHandler interface, which should
be defined in the mshtml assembly.
Apparently, it is not there.
Any ideas? Other solutions welcome as well!
Thanks in advance,
Guenter Tag: CheckedListBox ... Tag: 53345
Long drawing loop cancellation
Thinking about a standard "silly" problem of giving a user an option
to cancel long drawing loop, I read a lot of articles and did some
investigations of my own. (I work with C# .Net 2003).
My application must provide a very sophisticated drawing, which is
actually a millions-length sequence of simple line or ellipse drawings
executed in a very long loop. Naturally, I'd like to give a user an
option to cancel the drawing.
I have a number of rather bad solutions and I don't see any acceptable
one.
The Solutions are:
1. The drawing loop is execute in the UI thread and calls DoEvents()
to allow "Cancel" button to be pressed. The downside is well known
(see DoEvents() method adoption discussions) ? UI thread is busy and
natural events sequence is broken.
2. The drawing loop is executed not in the UI thread. The downside is
seldom exceptions. Generally, as I know, .Net does not allow drawing
from non UI thread.
3. The drawing loop is executed not in the UI thread but all drawing
operations are executed in the UI thread by calling Invoke for each
elementary drawing operation. Theoretically, this must be the correct
schema! . The downside is that Invoke() is a very expensive call, so
it works inappropriately long (see table below).
4. Using memory-stream metafile for buffering. Actually, this is not
what I need; in addition, it works even longer then #3.
Here is the execution time comparative graph for different
implementations of a loop with 2,000,000 drawing lines on my PC.
1. Execution in the UI thread (without DoEvents() calling) - time
00:00:04.6250592 (given as 1) and no "Cancel" available
2. Execution in the UI thread (calling DoEvents() on each step) -
00:00:10.5937500 (2.3 times longer)
3. Execution in a non UI thread (calling Invoke() for each drawing
operation) - 00:05:41.560314 (73.8 times longer)
4. Drawing in memory-metafile (no DoEvents() or Invoke() ) - execution
time 00:05:06.7153993 (66.3 times longer)
Of course, 5 minutes instead of 5 seconds is too much for such a
common task (a long loop cancellation). Any suggestions will be deeply
appreciated.
Alex Tag: CheckedListBox ... Tag: 53342
Cannot find CrystalReportViewer control
I did a full installation on VB .NET version 7.0 and .NET
framework 1.0. I tried to find the CrystalReportViewer in
the Toolbox but I couldn't. I also tried to look for it
in Tools/customize toolbox but still weren't successful.
Is it something to do with the VB .NET standard version
or enterprise version?
Also I found some control called CrystalReport, but it is
not mentioned in the .NET document. What's the difference
between this one and CrystalReportViewer?
Thanks in advance. Tag: CheckedListBox ... Tag: 53340
transfer a value from one form to another
I have a form with a textbox that will hold a mean value. When the textbox
gets focus, another form pops up, values are entered, and the mean value is
calculated. The mean value is stored in a Public variable. The two forms
are in different classes. How do I transfer this value to the original
textbox? Tag: CheckedListBox ... Tag: 53336
Opening a form over a control
Can anyone explain how set the location of a new windows form based aginst
the current loctaion of a control on a form, ie formA has a text control in
a group box and when the user starts typing in the text box I want to be
able to open a new form over the exact location of the textbox. the problem
I am having is that the textbox location is offset based aginst the groupbox
and not the form, pulling my hair out please help :) Tag: CheckedListBox ... Tag: 53333
Ole Automation Control in .Net
Dear all,
I want to embed word document in .net by ole
automation control, however, the control is only existing
in vb6. I have asked many people, they just say to use
axwebbrowser controls, however the controls is a little
bit limit functions! If I dont want to use the
webbrowsercontrols, what can i to use? Tag: CheckedListBox ... Tag: 53326
WebControl problem.
I am trying to iterate through the elements of a HTML
document loaded in a WebControl on a WinForm. I have
found many exemples and most of them are like the
following piece of code. Unfortunally this only catch the
tags HTML, STYLE, SCRIPT, HEAD and TITLE. I need to get
all the elements on the page specially the INPUT tags.
What am I missing?
Dim htDoc As mshtml.HTMLDocument
Dim oTags As Object
htDoc = webBrowserControl.Document
For Each oTags In htDoc.All
MsgBox(oTags.tagName)
Next
htDoc = Nothing Tag: CheckedListBox ... Tag: 53325
Excel Automation
This is a multipart message in MIME format.
--=_alternative 003B298F80256D74_=
Content-Type: text/plain; charset="US-ASCII"
Hi,
Is there a way (in VB.NET) to handle an opened Excel Process by his ID and
start using it as an Excel.Application object ???
Thanks in advance,
Carlos Cruz
--=_alternative 003B298F80256D74_=
Content-Type: text/html; charset="US-ASCII"
<br><font size=2 face="sans-serif">Hi,</font>
<br>
<br><font size=2 face="sans-serif">Is there a way (in VB.NET) to handle
an opened Excel Process by his ID and start using it as an Excel.Application
object ???</font>
<br>
<br><font size=2 face="sans-serif">Thanks in advance,</font>
<br>
<br><font size=2 face="sans-serif">Carlos Cruz</font>
--=_alternative 003B298F80256D74_=-- Tag: CheckedListBox ... Tag: 53316
Hidding Row Selector Columns of DataGrid
This is a multi-part message in MIME format.
------=_NextPart_000_00BA_01C35777.7C55FA40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi
i want to hide the row selector column, first column of the datagrid =
which allows to select complete row / shows ">" for the active row.
how can it be done?
Rajeev
------=_NextPart_000_00BA_01C35777.7C55FA40
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DVerdana size=3D2>Hi</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2>i want to hide the row selector =
column, first=20
column of the datagrid which allows to select complete row / shows=20
"<STRONG>></STRONG>" for the active row.</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>how can it be done?</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2>Rajeev</FONT></DIV></BODY></HTML>
------=_NextPart_000_00BA_01C35777.7C55FA40-- Tag: CheckedListBox ... Tag: 53314
Why i can't localizing datetimepicker control?
I use windows 2000 and set regional option as "thai". I
use datetimepicker control in my .net application. And I
chang Culture of my Application to "en-US" by use code
below
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-
US");
Thread.CurrentThread.CurrentUICulture = new CultureInfo
("en-US");
But my datetimepicker still display in thai language.
How can i display it in English language.
Thank You. Tag: CheckedListBox ... Tag: 53305
Accessing System Menu from C#
For a simple form without its own menu I wanted to add
an "About..." command to the system menu as I would for
an old MFC/C++ application.
However I cannot find out how to access the system menu
other than to toggle it on/off via the ControlBox
property.
Is this simply a .NET style being enforced (thou shalt
not modify the system menu) or am I overlooking something?
Thanks in advance!
-- TB Tag: CheckedListBox ... Tag: 53297
Office is blocked when invoking AxSHDocVw.AxWebBrowser method's navigate
I'm using a Winform and AxSHDocVw.AxWebBrowser, but when I use de
Navigate method if I have the office, for example: word, opened in
another window, it frozzes! and it remains blocked until I close my
window.
(by blocked I mean that I could not use the Word that was already open
before the Navigate invocation)
Thanks in Advance
garci Tag: CheckedListBox ... Tag: 53294
Error Reading Configuration Settings
Hi,
I am deploying a project to a laptop. It works fine on my development
computer, and I have tested once a few weeks ago.
However, this time, the program can not start at all. After some digging, I
find that it stops right at the following line (this line is part of the
function called by my program's initialization code):
--------------------------------------------------------------
//location is a string
location = ConfigurationSettings.AppSettings.Get("Location");
--------------------------------------------------------------
Before this line, everything is normal, but program just exit at this line.
I can not catch any exceptions at all, and the process just disappears in
"Windows Task Manager".
Any ideas?
Thanks a lot,
Guogang Tag: CheckedListBox ... Tag: 53291
Call WinForm with parameter?
Hello..is it possible to call a winform (show or
showdialog) and pass the form a parameter? Could be a
single value (like an integer)?
thanks for any help or links.
,dw Tag: CheckedListBox ... Tag: 53289
Newbie problem
Hi,
I'm having a problem with a windows application in VB.NET.
It is an MDI application, and I have just added a splash
screen that is displayed in the beginning of the
constructor of the mainform, and then is hidden at the
end of the constructor (after all the init is done for
the mainform).
The splash screen has a background image that fills all
the form. There is also 4 labels on top the the
background image. The problem is that for some reason,
when the splash screen is displayed, the labels are not
displayed. In fact, instead they act as if they were
transparent, so I see whatever is behind the form on my
desktop.
Any idea what can I do for this?
thanks,
Ross
. Tag: CheckedListBox ... Tag: 53287
Transparency Problems
I am attempting to wrap-up development cycle and have arrived at the point
where "small annoyances" can no longer be avoided<g>. I notice that other
applications windows (i.e. from other apps) "bleeding through" the UI from
time to time.
Now the "strange" thing is that the "underneath app" that always "bleeds
through" is Internet Explorer. I am at a loss as to how to proceed since I
have done nothing "knowingly" to enable any sort of transparency, all
TransparencyKey values have been left to their default values.
Carlos Tag: CheckedListBox ... Tag: 53286