How Do I stop Panel Control from scrolling automaticlly
I have a scrollable panel control with a large tab control in side of it. I
click on a tabpage to bring focus to it the panel control automatically
scrolls the top of the tabcontrol into view. I need to suppress this
automatic scrolling. Can any body give me some help on this.
Thanks,
Pat Converse... Tag: Designing controls Tag: 57586
Form Update
I am wondering if there is a method than can be called when updating several
controls on a form so the form does not repaint when each control is
updated. For example if there are 5 text boxes on the form and all of them
have to be updated I believe the form paints each time the Text property of
each textbox is changed.
I coded in PowerBuilder several years ago and they had a method that you
called before updating serveral controls on a form and then called another
method that repainted the form after you completed updating all the
controls.
Thank You in advance
Ken Tag: Designing controls Tag: 57585
How to change the control property on another form?
Hi,
I want to change the label button on one form from a Class? How do I do
that? I have made the property in the form to be public. But whenever I
close and open the file, it changes it back to private.
Thanks for the help.
Suresh Tag: Designing controls Tag: 57573
Setting selected value for a combox box.
Hi all,
Here is the sequence of events:
1) Retrieve a data table w/ my data.
2) Insert two rows at the begining of the table for
options that are always available.
3)Set the datasource, display member and value member for
my combo box accordingly.
4)Set the selected value of the combo box to that of one
of the rows I created and inserted into my data table in
step 2.
I keep getting an "out of range" error. I have verified
that the values match. I have also taken out that line
and set the combo box to the item manually and it
returned the correct value.
Is there a step I'm missing? Maybe something having to do
with inserted rows?
Thanks,
James Tag: Designing controls Tag: 57571
Panel.Enabled property and the propagation to subitems
Hello everybody,
I encounter problems with the Enabled-property of panels and the propagation
to subitems of the container.
Overview:
On a form there is one panel (named "A"), which surrounds all other controls
on the form (except two buttons). Inside panel A lies a checkbox. Below this
checkbox (and also inside A) panel B is located. The contents of panel B
should only be enabled if the checkbox is checked and enabled.
To implement this behaviour I attached an event handler to the
CheckedChanged-event of the checkbox. This handler enables panel B if the
checkbox is checked. A handler for the EnabledChanged-event sets panel B
enabled if the checkbox is checked and also enabled.
Below panel A there are two buttons:
- Button A toggles the Enabled-property of panel A. Panel A also changes the
Enabled-property of its contained controls (checkbox and panel B). This
propagation should be possible due to the fact that it is documented on
MSDN.
- Button B toggles the Enabled-property of the checkbox. The
EnabledChanged-event of the checkbox is fired and Panel B's Enabled-property
is also toggled.
So far so good. The problem is, that it is not working as expected.
- Initially all controls are enabled and the checkbox is checked.
- If you click button B, the checkbox and panel B are disabled. A repeated
click on button B enables them again. Correct.
- If button A is clicked, panel A is disabled. This deactivation is
propagated to the checkbox, which is disabled and then fires EnabledChanged.
The handler disables panel B as well. But panel B's contents are not redrawn
(i.e. the controls remain visually enabled). If you force to redraw panel
B's contents (by dragging the window out of the screen area) the correct
state is displayed.
Did I misunderstand the meaning of the Enabled-property or is this behaviour
by design?
For illustration purposes I wrote a little demo. Feel free to download the
sourcecode at http://it99.dyndns.org/axl/forms.zip
Best regards,
Alex
X-Post, F'Up set to microsoft.public.dotnet.framework.windowsforms
_______________________________________
Alexander Groß
Dipl.-Ing. (BA) für Informationstechnik
AlexanderGross@gmx.de
http://www.it99.org/axl
Wired: +49 (0) 3 41 / 47 84 97 70
Cellular: +49 (0) 1 75 / 410 72 68
ICQ# 36765668
_______________________________________ Tag: Designing controls Tag: 57563
How to embed a Help Window in Windows Forms
I am trying to display help toping using CHM files. I used the method
System.Windows.Forms.Help.ShowHelpIndex method or ShowHelp method, but a new
window is created and the contents are displayed, is there anyway we can
make that new form as a child of the main form and display within the
context of the main form? Please help me.
Thanks,
Rajan. Tag: Designing controls Tag: 57562
Menu.MenuItemCollection
I've added the System.Windows.Form.dll as a reference.
When I try to locate Menu.MenuItemCollection in the object browser I can't
find it or when coding at design time!
Am I missing something. Any help is appreciated.
Thanks,
RF Tag: Designing controls Tag: 57561
newbie ... forms vs usercontrols
Hi all,
i am not familiar with usercontrols, but what i have read
is that you can create controls that are like winforms
(with buttons, textfields etc ...)
what are the advantages/disadvantages in creating an
usercontrol for a screen (UI) compared to creating a form
in a windows application?
thanks,
jj Tag: Designing controls Tag: 57550
Problems with updating DB from Datarelation Databound textbox
Good day,
I am getting the error
message; "Column 'FK_Categories2Details.TagNbr' does not
belong to table CategoriesAndItems1" error message when I
try to save a change to a datarow.
This is how I am binding the
textbox; "txtCategoriesDate.DataBindings.Add("Text",
_dsNorthwindData.Table
(1), "FK_Categories2Details.TagNbr")"
This is the line of code that I get the above error
on; "dtSource.Rows(oTextBox.DataBindings
("Text").BindingManagerBase.Position).Item(sDataMember) =
oTextBox.Text". sDataMember
is "FK_Categories2Details.TagNbr"
Any way of solving this error would be helpful!
TIA,
Charles Tag: Designing controls Tag: 57548
problem: events for a form in a panel in a child window
Anyone have an idea on the following event behavior?
I have a MDI parent window; child window(s) which contain
multiple panels, one of which contains a form (say FormX).
I found that the FormX Activated/Deactivate events were
no longer occuring. (they had been occuring when FormX
was the child window, instead of being contained in the
child window)
I found mention of the Enter/Leave events, so I added
them to FormX. Unfortunently these only sometimes fire
for FormX.
I also found the MdiChildActivate event (in mdi parent),
and tried having it call down through the child window
into FormX to fire the FormX.Activate function, but still
with sporatic results.
Thanks Tag: Designing controls Tag: 57513
Setting ListView Focused Color
I am managing colors in my list view and setting the entire row to a given
color. If I select a row and then click in an area that does not have a
row, my previously selected row draws as white because it still has the
focus. There are too many scenarios that I would have to reset the focus.
Is there a way to set the focus color of the listview so that I never see
the white focused selection? Tag: Designing controls Tag: 57502
(Urgent)Regarding : STAThreadAttribute
Hi there,
I want to copy a Image to the clipboard. When i try to do so following
exception occurs :
"The current thread must set to Single Thread Apartment (STA) mode before
OLE calls can be made. Ensure that your Main function has
STAThreadAttribute marked on it"
Following are the points i want to say :
1. Which is the main method in windows forms ? When i tried to assign
<STAThread()> attribute to Public sub New () it gave me error.
2. I tried adding module contaning public sub main() assigning <STAThread()>
attribute, but above exception continues.
3. When i am checking the Threading.Thread.CurrentThread.ApartmentState
property in the function where exception is there , it is showing me the
value 1.
4. In my whole application I have never used Threads manually.But it does
contain many events.
Application i am working on is based on Client Server Architecure and
the code which gives exception is written on Server Side.This code gets
executed when request is received from the client.
Plz give me suggestions, its very URGENT.
Thanks in advance.
Chandrakant Shinde Tag: Designing controls Tag: 57500
Change Graph Line Colors at Runtime?
Using Crystal Reports 9 RDC, VS Studio 2003, C#, Client/Server Application
with Windows Forms.
Is it possible to change the graph line colors in a chart at runtime?
If so, does anyone have sample code for C#? Thanks in advance! Tag: Designing controls Tag: 57499
Catch key press in a datagrid
I have a windows forms data grid where I want to disallow the editing of
certain cells. At the moment though I can't get any code to trigger,
whether I include it in any of the DataGrid_KeyDown/Up/Press events.
Hopefully, I'm just doing something very silly.
--
Rob Oldfield
www.realuk.co.uk Tag: Designing controls Tag: 57498
Fill a combo box from collection, but bind to a custom class?
I am trying to do something a little nonstandard, and am having some
difficulty determining (a) if it can be done and (b) if so, how to do it.
What I want to do is fill a dropdown combobox with data from a collection.
Then, I want to bind that list to a member of a custom class. (Don't ask
why, just trust me on that one. <gr>).
What I'm doing now is binding the combo box to a collection, as follows:
Dim items As ArmorTypeCollection = ArmorTypeDac.Select()
With Me.ArmorType
.DataSource = items
.DisplayMember = "Value"
.ValueMember = "ID"
End With
Then, when the data is loaded onto the form, I set the default member as
follows:
Dim item As ArmorType
For Each item In ArmorType.Items
If item.ID.ToString() = _armor.Type.ID.ToString() Then
ArmorType.SelectedItem = item
Exit For
End If
Next
When the user commits her changes, I load them back into the object as
follows:
_armor.Type = ArmorTypeDac.Select().Item(Me.ArmorType.SelectedValue())
Is there a better way to do this? Essentially, my _armor object (of type
Armor) has a reference to an item in the armor type collection.
Any help would be greatly appreciated. Tag: Designing controls Tag: 57492
BUG Report. Please confirm.
Hi,
I'm previously haunted by a bug which is now in Knowledge Base Article
818587 (Fix: Regression in Dataset Serialization in Visual Studio .NET 1.1
when a datarow contains a rowError or a ColumnError Property) which can be
found at http://support.microsoft.com/default.aspx?scid=kb;en-us;818587.
Please note that this bug only shows itself if the Windows Form Application
is run on dotNetFramework 1.1 but does not shows itself if the same
application is forced to run on dotNetFramework 1.0
Now, I think I found another bug which produces the same error message as
the bug above and it also has something to do with the rowError or a
ColumnError property. Even worse, the bug exists in dotNetFramework 1.1 and
also dotNetFramework 1.0. The error message is,
System.InvalidOperationException: There is an error in XML document (x,
xxxx).
---> System.NullReferenceException: Object reference not set to an
instance of an object.
To reproduce the bug,
1. Create a Web service with a dummy method.
<WebMethod()> Public Function Dummy(ByVal ds As DataSet) As DataSet
Return ds
End Function
2. Create a Windows Application or a Console Application and add the service
that you created in step 1 as a Web Reference.
3. Type in or paste the following 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
Dim dt As DataTable
Dim row As DataRow
Dim i As Integer
' Create a new DataTable
dt = New DataTable
dt.TableName = "TestTable"
dt.Columns.Add("TestColumn1", GetType(String))
dt.Columns.Add("TestColumn2", GetType(Integer))
' Create a new DataSet and add the DataTable into it
ds = New DataSet
ds.DataSetName = "TestDataSet"
ds.Tables.Add(dt)
' Fill the DataTable with dummy values
For i = 0 To 10
row = dt.NewRow
row("TestColumn1") = "This is row " & i
row("TestColumn2") = i
dt.Rows.Add(row)
Next
' Set error message to the rows
For Each row In ds.Tables("TestTable").Rows
' Setting the RowError property below will cause and
' exception is thrown when calling ws.Dummy(ds.GetChanges).
row.RowError = "Row has not been updated to the server yet."
Next
' Send DataSet to the WebService
Try
ws = New localhost.Service1
ws.Dummy(ds.GetChanges)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
ws.Dispose()
End Sub
Can anyone confirm this? Thanks a lot. Tag: Designing controls Tag: 57488
Problems with Inherited Forms....
Hi,
I've created a new template class with some forms. one of
them is a main form (a MDIContainer-Form) with some
controls. It also contains a simple menu (everything is
PUBLIC).
Ok. Now I've a new project. I've created a new form
inheriting my templateform. Now, I'm able to add some menu
items to the menucontrol. So far so good, but if I close
the form (within the designer) and reopen it again : I
loose all my menuitems ! But if I run the project ->
everything is on my form !! So, the CODE for the menuitems
is there, but the designer doesn't show these..is this a
problem with the sub intializecomponent ? Any ideas ?
Thanks for your help.
Cheers,
Dominic Tag: Designing controls Tag: 57475
How to disable my Component in the toolbox?
Hi,
i have written a custom component that derives from
System.ComponentModel.Component.
It gets added to the toolbox correctly but I want it
to only be droppable on Forms, not on UserControls etc.
When a Form is currently displayed, the component should
be enabled in the toolbox, otherwise not.
Like the MainMenu component toolbox item does. It is
disabled when a UserControl is in design mode.
How do I get the same effect?
TIA
Martin Tag: Designing controls Tag: 57474
Escape characters in RichTextBox....
Hi !
I have a form. The form has a textbox and a richtextbox.
There is a button also. When the button is clicked,
whatever text was typed into the text box, must be copied
to the richtextbox.
At runtime, I enter the following string into the text
box:
Hi\nHello\nHow\nDo\nYou\nDo
Then I click the button. In the richtextbox I am expecting
Hi
Hello
How
Do
You
Do
But what I get is:
Hi\nHello\nHow\nDo\nYou\nDo
Ne idea to workaround this probs?
...Sinex Tag: Designing controls Tag: 57473
PropertyGrid with Multiple Selections
I have a propertygrid on a form, and I set SelectedObject or
SelectedObjects.
Everything is working perfectly if I set the PropertySort =
CategorizedAlphabetical.
If, however, I set the sort to Categorized, and then select multiple
objects, the property grid does not show all the properties that it
should show. For example, if I select 2 objects, both having
properties Hole1...Hole18, Hole2..9, and Hole18 show up but
1,10,11,12,13,14,15,16,17 do not show up.
Does anyone have an idea why? I am using a
System.ComponentModel.TypeConverter on the object that Hole1..Hole18
points to along with a UITypeEditor.
Just to repeat, EVERYTHING works fine if I set to
CategorizedAlphabetical. Everything except all the properties work
fine if set to Categorized.
Please do not ask WHY I am setting to categorized (it's just what I
want) or ask if stuff is working properly besides the display. They
all are working properly. Tag: Designing controls Tag: 57472
Control tips
I think I must be going mad. This has to be included in .Net and I just
can't find it. Controls on a windows form. How do I get explanatory text
to display when the user hovers the mouse over a control? (i.e. the stuff
that Access calls control tips)
Thanks.
--
Rob Oldfield
www.realuk.co.uk Tag: Designing controls Tag: 57471
Language support for UI application in win98
Hi all,
I have developed a application that supports localization in .net.
It shows all the controls with english and hindi text depending on the
culture selected.
The application runs well on windows 2000 and windows xp but when run on
windows 98 the hindi text appears as garbage. Can anyone help out
with this.(I have installed the .net framework on windows 98)
Regards,
Kuldeep Pawar
Programmer,
Maximize Learning, Pune. Tag: Designing controls Tag: 57454
Integral Number of Text Lines in RichTextBox
Hello,
I would like to set up a RichTextBox so that the text
shows an integral number of text lines when the text box
is scrolled all the way down. How can this be done?
I tried this: I set ClientSize.Height to be a multiple of
Font.Height, verify that it's set, but I get slightly
fewer than the expected number of lines. This means that
when the text box is scrolled all the way down, part of a
line shows at the top, which looks bad.
using System;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
class TextBoxTesterForm : Form
{
public TextBoxTesterForm()
{
d_rtb = new RichTextBox();
d_rtb.SuspendLayout();
d_rtb.Parent = this;
d_rtb.Location = new Point(10,10);
int desiredTextHeight = lines * d_rtb.Font.Height;
d_rtb.ClientSize = new Size(200, desiredTextHeight);
d_rtb.ResumeLayout();
Console.WriteLine("lines={0}", lines);
Console.WriteLine("rtb Font.Height = {0}",
d_rtb.Font.Height);
Console.WriteLine("rtb Font.GetHeight() = {0}",
d_rtb.Font.GetHeight());
Console.WriteLine("desiredTextHeight = {0}",
desiredTextHeight);
Console.WriteLine("rtb ClientSize = {0}",
d_rtb.ClientSize);
Console.WriteLine("rtb DisplayRectangle = {0}",
d_rtb.DisplayRectangle);
Console.WriteLine("rtb Size = {0}", d_rtb.Size);
Console.WriteLine("rtb Multiline = {0}", d_rtb.Multiline);
}
RichTextBox d_rtb;
int lines = 5;
}
class TextBoxTestMain {
static void Main()
{ Application.Run(new TextBoxTesterForm()); }
} Tag: Designing controls Tag: 57449
CheckedListBox crashes after complex datasource is modified
Hi,
I am using a checkedlistbox on a windows form and binding it to a
collection of classes.
clbAliases is the checkedlistbox control
selectedplace is a class with property placealiases.This property is a
collection of placealias classes. Hopefully the rest is
self-explanatory..
I bind the control as follows:
If SelectedPlace.PlaceAliases.Count > 0 Then
SetCLBAliasDataSource()
Else
clbAliases.DataSource = Nothing
End If
Private Sub SetCLBAliasDataSource()
clbAliases.DataSource = Nothing
clbAliases.DisplayMember = "AliasName"
clbAliases.DataSource = SelectedPlace.PlaceAliases
End Sub
Then when I modify the underlying collection ( specifically for delete
functionality )
I have this:
Private Sub btnDeleteAlias_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnDeleteAlias.Click
If SelectedPlace.PlaceAliases.Count = 1 Then
MsgBox("You cannot delete the primary alias.")
Exit Sub
Else
Dim item As Object
For Each item In clbAliases.CheckedItems
'clbParents.Items.Remove(item)
SelectedPlace.PlaceAliases.Remove(item.placenameid)
Next
'this forces the control to rebind to the modified
collection
SetCLBAliasDataSource
End If
End Sub
Everything works as expected, EXCEPT once the item is removed, and the
user clicks into the checkedlistbox area , specifically on any
remaining item in the box, the following error occurs:
"An unhandled exception of type 'System.ArgumentOutOfRangeException'
occurred in mscorlib.dll
Additional information: Index was out of range. Must be non-negative
and less than the size of the collection."
I have experimented with refreshing the checkedlistbox, and a number
of various other attempted workarounds without success.
The error occurs whether I specify a ValueMember property or not. When
I inspect the underlying collection in the locals window, it appears
normal, as does the items collection of the control. And both contain
the expected number of items. In addition the control correctly
displays the remaining items.
I can only assume that the control is referencing a non-existent
collection member somewhere in the click event event args. Execution
breaks on the line with the class definition :
Public Class GISMain
Can anyone point out a workaround, or my mistake??
Thanks in advance for any help..
Matthew Evans
Someone replied in another ng saying that checkedlistboxes were flaky,
specifically on 1.0... So I tried a rebuild of the application on
VS.2003 / V1.1 of the framework , and the error occurs there too. the
error message on that platform is :
"An unhandled exception of type 'System.ArgumentOutOfRangeException'
occurred in microsoft.visualbasic.dll
Additional information: Specified argument was out of the range of
valid values."
Similar, but not identical....
Once again, any help / pointers much appreciated... Tag: Designing controls Tag: 57432
Getting data from a datagrid
Hello,
I have a bound datagrid called dgjobs that is bound
to a dataset called dsjobs using the following code.
Me.dgJobs.DataSource = dsJobs.Tables!Jobs
cm = CType(Me.BindingContext(dsJobs.Tables!jobs),
CurrencyManager)
The grid populates just fine however when the
currentcellchanged event is triggered (i.e. when you
scroll or click another row) I wish to get the value of the
first column (jobkey) in the currently selected row so
that I may use this as a parameter for a procedure. Any
ideas how I can read the data from the grid.
Thanx in advance
Robert Batt Tag: Designing controls Tag: 57421
Layout problem - Mainmenu + toolbar + a "filled" control
I have a form that has a main menu (dock: top) and a tookbar (dock: top)
I tried to insert a control that is (dock: fill)
I found that the toolbar actually 'covered' the top of the 'filled'
control....
how should I solve this?! Tag: Designing controls Tag: 57420
Process -> MainWindowHandle always coming back as 0???
I'm using a mutex to ensure only 1 instance of my app is created. It works
fine.
If an instance of my app IS already running, I want to use the following
code to bring the window to the foreground. BUT, the MainWindowHandle is
always 0 (I checked all processes and they are all 0). How can I get the
window handle back? Or, is there another way to popup my application?
Thanks,
Steve
if (!grantedInitialOwnership)
{
Process[] ps =
Process.GetProcessesByName("AppName");
IntPtr hWnd = ps[0].MainWindowHandle;
// Show existing instance
if (hWnd.ToInt64() != 0)
{
SetForegroundWindow(hWnd);
ShowWindow(hWnd, 5); // SW_SHOW
}
} Tag: Designing controls Tag: 57414
The listmanager's position must be equal to rownum.
Please help me.
I must correct this error :
The listmanager's position must be equal to rownum.
Parameter name : rownum do you want to correct the value ?
I have this error with VS2002 and also with VS2003.
______________________
I'd like to have a datagrid with all the columns of my table EXAMPLE and a
new column with a checkbox to select some row.
So.. i use a select to put my data in my data adapter.
( SELECT example.ID, example.name, ...........,false as col_for_sel
.... the col_for_sel is the column that i'll use to check or not the row )
I fill with my D.A. a new datatable....
I'll use a data grid to view my data with a datagridestyle.
I don't know what i can control :-(
-------------------------------- Tag: Designing controls Tag: 57408
Preventing deletion of certain characters
In a textbox control, how can you prevent the deletion of
certain characters? For example, a user shouldn't be able
to delete the backslash "/" character but can delete other
characters. Thanks a lot :) Tag: Designing controls Tag: 57405
Validating events
Hello,
How can i disable the Validating Event of all the controls of a form after a
click on a Cancel Button and close the Form?
Or how can fix the order of Validating events of the controls in a Form?
Thanks in advance.
Pascal Tag: Designing controls Tag: 57401
How to get App path of WinService
I was using Environment.CurrentDirectory when I tested my class in a winform
wrapper, but but now that I've move it to a WinService this gives me
"C:\WinNT\System32"
How can I get the Path of my assembly?
Thanks in Advance,
Byron Tag: Designing controls Tag: 57397
adding objects to the clipboard in .NET
I am unable to add a button to the clipboard. This is
required to do drag and drop of the object - button.
I am able to add a string to the clipboard. The following
is a summary of my steps. Any help greatly appreciated.
Button button2 = new Button();
DataObject data = new DataObject();
data.SetData("myButton", button2);
Clipboard.SetDataObject(data, true);
IDataObject data = Clipboard.GetDataObject();
object obj = data.GetData("myFormat"); // returns obj
== null
Button btn = (Button)data.GetData("myFormat"); //
returns btn == null
btn = (Button)data.GetData(typeof(Button)); // returns
btn == null
Thanks... Tag: Designing controls Tag: 57393
WinService Uninstall failed How do I clean up?
Hi, I followed the tutorial for setting up a WinService install and got the
messages below. If it's already on the system as it says then I should be
able to see it in the Services list but I didn't see it there.
How can I remove a WinService manually?
Thanks in Advance,
Byron
-------------
InstallUtil.InstallLog:
Running a transacted installation.
Beginning the Install phase of the installation.
See the contents of the log file for the c:\program files\twsm\ecpu\ecpu.exe
assembly's progress.
The file is located at c:\program files\twsm\ecpu\ecpu.InstallLog.
An exception occurred during the Install phase.
System.ArgumentException: Source eCPU already exists on the local computer.
The Rollback phase of the installation is beginning.
See the contents of the log file for the c:\program files\twsm\ecpu\ecpu.exe
assembly's progress.
The file is located at c:\program files\twsm\ecpu\ecpu.InstallLog.
The Rollback phase completed successfully.
The transacted install has completed.
------------
eCPU.InstallLog:
Installing assembly 'c:\program files\twsm\ecpu\ecpu.exe'.
Affected parameters are:
assemblypath = c:\program files\twsm\ecpu\ecpu.exe
logfile = c:\program files\twsm\ecpu\ecpu.InstallLog
Installing service eCPU...
Creating EventLog source eCPU in log Application...
Rolling back assembly 'c:\program files\twsm\ecpu\ecpu.exe'.
Affected parameters are:
assemblypath = c:\program files\twsm\ecpu\ecpu.exe
logfile = c:\program files\twsm\ecpu\ecpu.InstallLog
Restoring event log to previous state for source eCPU. Tag: Designing controls Tag: 57385
Can't start new projects in VS 2003
I can start a new project in VS2003, and don't put any controls or code in
form1, leave everything as VS writes it. Now I run it. Should just pop up a
blank form right? UhUh.
An unhandled exception of type "System.NullreferenceException' occurred
in Unknown Module.
Additional information: Object reference not set to an instance of an
object.
If you break there is no code for the current location. The app will build
without errors but I can't run it outside of vs either.
I can do this over and over again (definition of stupid) Once a few days
ago, I started one of these in a directory other than the default (actually
a subdirectory) and it worked and I could then write a small utility without
further problems. Runs fine in debugger still.
However it doesn't seem to make any difference where I put a new project
now.
I have read every forum posting on this problem and tried everything
suggested. Have also uninstalled and reinstalled the framework 1.1 as well
as VS twice to no avail.
Suggestions?
Many thanks Tag: Designing controls Tag: 57384
.Net App deployment - Removing files problem
How do I instruct the Windows installer to remove the entire application
when the user clicks Remove program from Windows control panel?
After a successful setup, any files created by the application in the
application folder are not removed. This is so when the program is
"removed" from the Windows control panel. This becomes a problem if the
user decides to reinstall the application in the same location. The
*old*/legacy files, e.g. app config files, may cause a problem with the
*new* installation of the application file.
My installer program was created with a "setup and deployment" type project
is Visual Studio.NET 2003 for a .NET v 1.1 Windows Forms application. It
appears all of the property pages in the VS.NET editor address installation
and few removal issues. I reckon I'm sniffing around for a solution in the
wrong place.
--
Peter O'Reilly Tag: Designing controls Tag: 57382
.Net App deployment - Removing files problem
How do I instruct the Windows installer to remove the entire application
when the user clicks Remove program from Windows control panel?
After a successful setup, any files created by the application in the
application folder are not removed. This is so when the program is
"removed" from the Windows control panel. This becomes a problem if the
user decides to reinstall the application in the same location. The
*old*/legacy files, e.g. app config files, may cause a problem with the
*new* installation of the application file.
My installer program was created with a "setup and deployment" type project
is Visual Studio.NET 2003 for a .NET v 1.1 Windows Forms application. It
appears all of the property pages in the VS.NET editor address installation
and few removal issues. I reckon I'm sniffing around for a solution in the
wrong place.
--
Peter O'Reilly Tag: Designing controls Tag: 57380
Changing the line colors of a Crystal Report at runtime?
Hello
I am running .NET 2003, Framwork 1.1, Crystal Report Version 9. I am writing
all my code in C#.
I have two questions:
1) Does anyone know if the line color in a chart on a Crystal Report can be
changed at runtime?
2) Does anyone know if a report can be created from a collection?
If the answer to either of these is yes, can you please supply sample code
in either VB.NET or C#.NET? Thanks in advance for your time!
Ken Tag: Designing controls Tag: 57378
inputbox for C#
Hello,
Just wondering if there is an equivelant available to C#
for quick string input. I am NOT using vb.net so i cant
use that version.
TIA,
Mel Tag: Designing controls Tag: 57374
Can't disable Add New row at bottom of Datagrid
--------------F34FF1FF13222AD377793457
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Based on this post from Clay Burch and the SyncFusion FAQ website, I
tried to disable my add new row at the bottom of my datagrid. However
the add new row still shows up. When I click on it my app crashes. Can
anybody look at the routine I've included at the bottom and tell me what
I did wrong?
Thanks,
Steve
Clay's Post:
You can do this by getting at a dataview associated with the datagrid,
and
setting its AllowNew member. Here is one way you can do this.
CurrencyManager cm =
(CurrencyManager)this.BindingContext[dataGrid1.DataSource,
dataGrid1.DataMember];
//no adding of new rows
((DataView)cm.List).AllowNew = false;
===================================
Clay Burch
Syncfusion, Inc.
My Routine:
private void loadMessagesDataGrid(ref DataTable msgsDataTable)
{
DateTime startDateTime = DateTime.Now.AddDays(-1);
string messagesSelectStr = "SELECT id, fldtimestamp, "+
"payload, direction, state, transNum, port "+
"FROM messages "+
"WHERE port = "+Port+" "+
"AND fldtimestamp > #"+startDateTime+"# "+
"ORDER BY fldtimestamp DESC";
// Create data adapter objects
MessagesDataAdapter = new OleDbDataAdapter(messagesSelectStr,
Db.getConnection());
MessagesDataAdapter.TableMappings.Add("Table1", "messages");
createMessagesInsertAndUpdateCommands(MessagesDataAdapter, Db);
try
{
MessagesDataAdapter.Fill(dgDataSet, "messages");
}
catch (Exception ex)
{
Log.WriteLine("Exception Filling messagesDataAdapter: "+ex.Message);
return;
}
DataGridTableStyle messagesStyle = null;
try
{
messagesStyle = new DataGridTableStyle();
messagesStyle.MappingName = "messages";
}
catch (Exception ex)
{
Log.WriteLine("Exception getting DataGridTableStyle: "+ex.Message);
return;
}
// HERE IS THE FIRST LINE SUGGESTED BY SYNCFUSION
CurrencyManager cm = (CurrencyManager)BindingContext[dgDataSet,
"messages"];
try
{
int numCols = dgDataSet.Tables["messages"].Columns.Count;
DataGridColoredTextBoxColumn aColumnTextColumn ;
for(int i = 0; i < numCols; ++i)
{
aColumnTextColumn = new DataGridColoredTextBoxColumn(this);
aColumnTextColumn.HeaderText =
dgDataSet.Tables["messages"].Columns[i].ColumnName;
aColumnTextColumn.MappingName =
dgDataSet.Tables["messages"].Columns[i].ColumnName;
if(i == 1) // fldtimestamp
{
aColumnTextColumn.Format = "g";
}
messagesStyle.GridColumnStyles.Add(aColumnTextColumn);
}
messagesStyle.GridColumnStyles["fldtimestamp"].Width = 110;
messagesStyle.GridColumnStyles["payload"].Width = 250;
messagesStyle.GridColumnStyles["direction"].Width = 0;
messagesStyle.GridColumnStyles["state"].Width = 75;
messagesStyle.GridColumnStyles["transNum"].Width = 0;
messagesStyle.GridColumnStyles["port"].Width = 0;
messagesDataGrid.TableStyles.Clear();
messagesDataGrid.TableStyles.Add(messagesStyle);
// HERE IS THE SECOND LINE SUGGESTED BY SYNCFUSION
((DataView)cm.List).AllowNew = false;
}
catch (Exception ex)
{
Log.WriteLine("Exception setting up TableStyles: "+ex.Message);
return;
}
// bind messages data grid with messages data table
try
{
msgsDataTable = dgDataSet.Tables["messages"];
messagesDataGrid.DataSource = msgsDataTable;
msgsDataTable.DefaultView.Sort = "fldtimestamp DESC";
}
catch (Exception ex)
{
Log.WriteLine("Exception: "+ex.Message);
}
}
--------------F34FF1FF13222AD377793457
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
<br>Based on this post from Clay Burch and the SyncFusion FAQ website,
I tried to disable my add new row at the bottom of my datagrid. However
the add new row still shows up. When I click on it my app crashes.
Can anybody look at the routine I've included at the bottom and tell me
what I did wrong?
<br>Thanks,
<br>Steve
<p>Clay's Post:
<p><font face="Courier New,Courier"><font size=-1>You can do this by getting
at a dataview associated with the datagrid, and</font></font>
<br><font face="Courier New,Courier"><font size=-1>setting its AllowNew
member. Here is one way you can do this.</font></font>
<br><font face="Courier New,Courier"><font size=-1></font></font> <font face="Courier New,Courier"><font size=-1></font></font>
<p><font face="Courier New,Courier"><font size=-1>CurrencyManager cm =</font></font>
<br><font face="Courier New,Courier"><font size=-1>(CurrencyManager)this.BindingContext[dataGrid1.DataSource,</font></font>
<br><font face="Courier New,Courier"><font size=-1>dataGrid1.DataMember];</font></font><font face="Courier New,Courier"><font size=-1></font></font>
<p><font face="Courier New,Courier"><font size=-1>//no adding of new rows</font></font>
<br><font face="Courier New,Courier"><font size=-1>((DataView)cm.List).AllowNew
= false;</font></font><font face="Courier New,Courier"><font size=-1></font></font>
<p><font face="Courier New,Courier"><font size=-1>===================================</font></font>
<br><font face="Courier New,Courier"><font size=-1>Clay Burch</font></font>
<br><font face="Courier New,Courier"><font size=-1>Syncfusion, Inc.</font></font>
<p>My Routine:
<br> private void loadMessagesDataGrid(ref DataTable msgsDataTable)
<br> {
<br> DateTime startDateTime = DateTime.Now.AddDays(-1);
<br> string messagesSelectStr = "SELECT id, fldtimestamp, "+
<br> "payload, direction, state, transNum, port "+
<br> "FROM messages "+
<br> "WHERE port = "+Port+" "+
<br> "AND fldtimestamp > #"+startDateTime+"# "+
<br> "ORDER BY fldtimestamp DESC";
<p> // Create data adapter objects
<br> MessagesDataAdapter = new OleDbDataAdapter(messagesSelectStr,
Db.getConnection());
<br> MessagesDataAdapter.TableMappings.Add("Table1", "messages");
<p> createMessagesInsertAndUpdateCommands(MessagesDataAdapter,
Db);
<p> try
<br> {
<br> MessagesDataAdapter.Fill(dgDataSet, "messages");
<br> }
<br> catch (Exception ex)
<br> {
<br> Log.WriteLine("Exception Filling messagesDataAdapter:
"+ex.Message);
<br> return;
<br> }
<p> DataGridTableStyle messagesStyle = null;
<br> try
<br> {
<br> messagesStyle = new DataGridTableStyle();
<br> messagesStyle.MappingName = "messages";
<br> }
<br> catch (Exception ex)
<br> {
<br> Log.WriteLine("Exception getting DataGridTableStyle:
"+ex.Message);
<br> return;
<br> }
<br>
<br>// HERE IS THE FIRST LINE SUGGESTED BY SYNCFUSION
<br> CurrencyManager cm = (CurrencyManager)BindingContext[dgDataSet,
"messages"];
<br> try
<br> {
<br> int numCols = dgDataSet.Tables["messages"].Columns.Count;
<br> DataGridColoredTextBoxColumn aColumnTextColumn ;
<br> for(int i = 0; i < numCols; ++i)
<br> {
<br> aColumnTextColumn = new DataGridColoredTextBoxColumn(this);
<br> aColumnTextColumn.HeaderText = dgDataSet.Tables["messages"].Columns[i].ColumnName;
<br> aColumnTextColumn.MappingName = dgDataSet.Tables["messages"].Columns[i].ColumnName;
<br> if(i == 1) // fldtimestamp
<br> {
<br> aColumnTextColumn.Format = "g";
<br> }
<br> messagesStyle.GridColumnStyles.Add(aColumnTextColumn);
<br> }
<p> messagesStyle.GridColumnStyles["fldtimestamp"].Width
= 110;
<br> messagesStyle.GridColumnStyles["payload"].Width
= 250;
<br> messagesStyle.GridColumnStyles["direction"].Width
= 0;
<br> messagesStyle.GridColumnStyles["state"].Width =
75;
<br> messagesStyle.GridColumnStyles["transNum"].Width
= 0;
<br> messagesStyle.GridColumnStyles["port"].Width = 0;
<p> messagesDataGrid.TableStyles.Clear();
<br> messagesDataGrid.TableStyles.Add(messagesStyle);
<p>// HERE IS THE SECOND LINE SUGGESTED BY SYNCFUSION
<br> ((DataView)cm.List).AllowNew = false;
<p> }
<br> catch (Exception ex)
<br> {
<br> Log.WriteLine("Exception setting up TableStyles:
"+ex.Message);
<br> return;
<br> }
<p> // bind messages data grid with messages data table
<br> try
<br> {
<br> msgsDataTable = dgDataSet.Tables["messages"];
<br> messagesDataGrid.DataSource = msgsDataTable;
<br> msgsDataTable.DefaultView.Sort = "fldtimestamp DESC";
<br> }
<br> catch (Exception ex)
<br> {
<br> Log.WriteLine("Exception: "+ex.Message);
<br> }
<br> }
<br>
</body>
</html>
--------------F34FF1FF13222AD377793457-- Tag: Designing controls Tag: 57371
Tab Control with Combo Box
I have a windows form that contains a tab control. On
one of the tabs I have a combo box bound to a datatable.
When I first enter the tab I initialize the selectedindex
of the combobox to -1. I then type text into the combo
box that does not match any entries in the dropdown
list. If I then choose a different tab and return to my
tab with the combo box, the selectedindex has been
changed to 0 and the text I entered is replaced with the
text from list item 0. Why does the combo box not retain
a selectedindex of -1 with the text I entered? How can I
correct this?
Thank You,
Don Tag: Designing controls Tag: 57370
Help with ListView
I am trying to get data from a CollectionBase derived class into a ListView.
Currently the output is one continuous line of data that is of Boolean type
e.g. True True False True False False False True .
No other data or header information is displayed.
public class RecFormCtxSaved
{
private Boolean enabled;
private Boolean selected;
private string column;
private string text;