Control focus in enabled/disabled panels
I'm having some trouble with Windows Forms in .NET 1.1 that I haven't
been able to find a soution for. Below is a sample form that shows my
problem. Basically, the form has two panels that switch their enabled
state with the button presses. But trying to navigate the form purely
with the keyboard (tab / arrow keys), results in the inability to
select any controls beside buttons (the text boxes / date time picker
will never recieve focus) when the one panel becomes disabled and the
second enabled (or vice-versa). Does anyone know a solution for this
phenomenon? Thanks.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace TestFormsApp
{
/// <summary>
/// Summary description for PanelTest.
/// </summary>
public class PanelTest : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox2;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public PanelTest()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.panel2 = new System.Windows.Forms.Panel();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.button2 = new System.Windows.Forms.Button();
this.textBox2 = new System.Windows.Forms.TextBox();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.textBox1);
this.panel1.Controls.Add(this.button1);
this.panel1.Location = new System.Drawing.Point(24, 16);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(136, 104);
this.panel1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(24, 56);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "Switch";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(16, 16);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 1;
this.textBox1.Text = "textBox1";
//
// panel2
//
this.panel2.Controls.Add(this.textBox2);
this.panel2.Controls.Add(this.button2);
this.panel2.Controls.Add(this.dateTimePicker1);
this.panel2.Enabled = false;
this.panel2.Location = new System.Drawing.Point(16, 136);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(256, 136);
this.panel2.TabIndex = 1;
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(32, 56);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.TabIndex = 0;
//
// button2
//
this.button2.Location = new System.Drawing.Point(88, 96);
this.button2.Name = "button2";
this.button2.TabIndex = 1;
this.button2.Text = "Go Back";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(32, 16);
this.textBox2.Name = "textBox2";
this.textBox2.TabIndex = 2;
this.textBox2.Text = "textBox2";
//
// PanelTest
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(496, 526);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "PanelTest";
this.Text = "PanelTest";
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void button1_Click(object sender, System.EventArgs e) {
this.panel1.Enabled = false;
this.panel2.Enabled = true;
}
private void button2_Click(object sender, System.EventArgs e) {
this.panel1.Enabled = true;
this.panel2.Enabled = false;
}
}
} Tag: Composite controls don't persist data? Tag: 101890
ClickOnce deployment security on the Internet
We have a TabletPC application used by remote, roaming users who only have
Internet access. We would like to place the deployment site on our Internet
so they will be able to apply updates, however the issue of security for
ClickOnce seems not to have been considered by Microsoft for some odd reason
(considering that Microsoft has, in theory, become so security conscience
these days). For example, we would like the users to be authenticated prior
to applying updates. This can be somewhat dicey because we do not have AD
for our internal network users in the DMZ, even if it could be done at all
(which appears to not be the case).
Has anyone faced this issue and, if so, how did you go about solving it? Tag: Composite controls don't persist data? Tag: 101885
Background worker / Progress Bar
Hi,
I'm building an app that performs a long running operation when the user
clicks a button. I'm not sure how long the operation will take up front and
its not an interative task. I have 2 problems at the moment, one is
cancelling the operation and the other is displaying 'progress'. I've decided
to use the BackgroundWorker component in .Net 2.0 but I guess this is still a
relevent 1.1 question.
My first problem is when clicking the run button I change the text of the
button to cancel so when the user clicks it a second time I call the
backgroundWorker CancelAsync. This changes the text and allows the user to
run the process again. The problem is it doesn't seem to cancel the work
being done...instead the work continues and eventually it calls the work
completed method with e.cancelled being true etc but the main problem is not
time is saved....
The second problem is updating progress to the user. Since I have no idea
how long it will take and can't break the task up into steps I thought of
using the progress bar and moving progress up and down just to show something
is happening. Any suggestions for how to do this or a better way to do it?
Thanks
N Tag: Composite controls don't persist data? Tag: 101882
Restore Form To Previous Size
I have an application where users can minimize it to the systray. I
would like when the user restores the application from the systray to
return to the previous forms size.
If the form was maximized when minimized and I use the following code
this.WindowState = FormWindowState.Normal ;
the form is not resized back to its previous maximized state.
I figured I could grab the location and size of the form prior to
minimizing using
formXLocation = this.Location.X;
formYLocation = this.Location.Y;
formSizeWidth = this.Size.Width;
formSizeHeight = this.Size.Height;
However, I am not sure exactly how to force the form back to those
sizes since you can't call
this.Location.X = ... since Location.X is not a variable.
Thanks,
Amy Tag: Composite controls don't persist data? Tag: 101881
Can I Get DoubleBuffered Graphics object by using CreateGraphic()?
Hi, all
I am working on a image anasis project, mang chart need to be draw,
How can I draw a chart on a label in my form?
labelObject.CreateGraphic() return a non DoubleBuffered Graphic object,
How can I do it?
thanks for any advice. Tag: Composite controls don't persist data? Tag: 101875
Professional Web Designs
Professional Web Designs
Professional Web design and other web development is what wicked
innovations specialized.
Internet Marketing - Website Traffic - SEO Tips. Internet marketing
solutions, marketing tips for increased web site traffic, professional
web templates, affordable web hosting, search engine...
Team that has extensive experience in website design and development
and also considering the quality and professionalism that goes into
every work, custom Website design solutions and dynamic, a
professional, friendly, motivated staff ready to help turn your
business into profitable, online marketplace.
To see our eye-catching design
http://www.wickedinnovations.com/porforlioMS.html
And to contact us: http://www.wickedinnovations.com/contact.html Tag: Composite controls don't persist data? Tag: 101869
How to wait till webbrowser completes sending a form?
I've got a program that has to submit forms automaticly and go to the
next page.
I know that the following code works for Navigate but it hasn't any
affect on Documents.Forms[0].InvikeMember("Submit");.
=== My code ===
Browser.Navigate("http://www.google.com/");
while (Browser.ReadyState != WebBrowserReadyState.Complete)
Application.DoEvents();
=== My code ===
Does any know the sollution, I preffer to don't use a variable that's
been set on the event DocumentCompleted. Tag: Composite controls don't persist data? Tag: 101867
Each windows form as individual dll
I am working in windows application using c#2.0. I have to convert each
form in my application as a seperate dll. Tag: Composite controls don't persist data? Tag: 101865
Control.BackColor Transparency, Control.BackColor = Color.Transparent
in my app i need to make a RichTextbox control transparent.
i need it to be a like a pane of glass lying on a sheet of paper, where u
can see everything on the sheet of paper not covered by text written on the
glass pane. i need to be able to see the control or form that is underneath
the RichTextbox, and at the same time to be able to write and erase text to
the RichTextbox.
i'm assuming that it is the backcolor that hides what is underneath a
control. so i tried setting rtb.BackColor = Color.Transparent.
when u do that u get a error that BackColor may not be Color.Transparent.
bummer. i looked for help and found the following link on the cd that came
with net 2005
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxmclictl/html/32433e63-f4e9-4305-9857-6de3edeb944a.htm
the heading is:
How to: Give Your Control a Transparent Background
in it it tells u the following:
========================
By default, controls do not support transparent backcolors. However, you can
allow your control to have a background color that is opaque, transparent,
or partially transparent by using the Control.SetStyle Method in the
constructor. The SetStyle method of the Control class allows you to set
particular style preferences for your controls, and can be used to enable or
disable support for transparent backcolors.
To give your control a transparent backcolor
Locate the constructor for your control class.
Call the SetStyle method of your form in the constructor.
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
This will enable your control to support a transparent backcolor.
Beneath the line of code you added in step 1, add the following line. This
will set your control's BackColor to Transparent.
Me.BackColor = Color.Transparent
======================================
i subclassed the RichTextbox control, added a constructor, as follows: (i
tried Me.SetStyle(ControlStyles.Opaque, False)
& Me.SetStyle(ControlStyles.Opaque, True) & omitting it alltogether, it
didn't help.)
---------------
Public Class clsRtbx
Inherits System.Windows.Forms.RichTextBox
Sub New()
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
Me.SetStyle(ControlStyles.Opaque, False)
Me.BackColor = Color.Transparent
End Sub
End Class
--------------
to test it, i did the following in the Form_Load event
Dim rtb2 As New clsRtbx
rtb2.Text = ""
rtb2.Top = 0
rtb2.Left = 0
rtb2.Width = 300
rtb2.Multiline = True
rtb2.Height = 200
rtb2.BackColor = Color.Transparent 'i tried with this line, and without
it
Me.Controls.Add(rtb2)
rtb2.BringToFront()
when i did this, i did not get the color transparency error, but it still
hides everything underneath itself!
am i missing something?
i would greatly appreciate to find out if a control can be make transparent
(as explained above, to see what is underneath it, while being able to
write/erase to it), and how to do it.
thanks, ray Tag: Composite controls don't persist data? Tag: 101864
Adding Scroll bar to MDI Client Control
Hi All,
I am currently working in a windows application designed in C# 2.0.
The application is the MDI application.
At the launch of the application, for the MDI Parent, i want to
calulate the size of the MDI client that should be(Using some my own
formula) and it should set the width accordingly. If the width exceeds
the current display area, it should show the scroll bar.
Perviously i was trying with the AutoScroll property for the form to be
true and AutoScrollMinSize property to control the view of the Scroll
Bar. But Setting these property causes the Form's IsMDIContainer to
becomes false.
So can any body helps me out how can i give the size of the MDIClient
control (for the MDI Parent form) to be larger then the current window
size and showing the scroll bar if it is required.
Thanks
Vikash Tag: Composite controls don't persist data? Tag: 101863
treeview labeledit
How to edit a treeview node label from code?
now when i create a new node (in runtime) i have to click once more on
that node to edit it... how to invoke that state from code right after
creating it?
thanks Tag: Composite controls don't persist data? Tag: 101861
Windows Forms Interview Questions?
Hi everybody,
I have been doing a search for Windows Forms Interview questions using
Google, and I havent found much at all. If you know of a useful place to
look, I would be really grateful.
Thank you,
jr. Tag: Composite controls don't persist data? Tag: 101859
Watch objects in memory in visual studio
hi,
is there anyway to watch objects which are placed in memory in visual
studio.
for instance, assume that you have two forms in your application, and
your are debgging the application and also one of these forms. what i
want to know is how i can watch the another form objects ?
bye Tag: Composite controls don't persist data? Tag: 101854
A client for a webservice
I'm developing c# windows application as a client for a web service.
While i was designing the interface i discoverd that i'm totally stuck,
i need to enumerate a list of links on a panel with a limited area that
to be scrolled if the news was greater than the panel size.
Can anyone help by sending a sample or by telling me how to overcome
this issue. Tag: Composite controls don't persist data? Tag: 101852
Global objects
I have an application which is comprised of, among many other things, a
Main form which shows various user controls depending on which NavBar
link they click on. In addition, there are many Entity classes that I
created to support the application, one of which happens to be called
User. In my main form I currently instantiate a User which corresponds
with the user who logged in. The User object that is created
(g_oCurrentUser) is declared as Private in my Main form's code, but
there is a Public function (GetCurrentUser) that returns a pointer to
g_oCurrentUser.
My question is "Is there a way for the entity classes to "get at" the
g_oCurrentUser object from the main form? The reason I need to do this
is because I want to pull the current user's ID to use for populating
the fkLastUpdatedByUserID field of the entities when they have been
changed by the current user.
Is there a way to do this? I guess my question, more generally, is how
can I have Object variables that are accessible both to the Main form
and to other parts of the system (e.g. user controls that will be
created later and shown on the form, other Objects, modules, etc.)? Tag: Composite controls don't persist data? Tag: 101845
Login Form
I have a login form that I want to show before the Main form loads. I
am currently showing it in the Main form's Load event. If ModalResult
of form does not return as DialogResult.OK, I call Me.Close for the
Main Form.
1) Is best place to show it in Main form's Load event?
2) Is calling Me.Close in Load event the best way to keep the Main form
from ever showing (i.e. quitting the application before it even
appears)?
If answer to either question above is No, please advise as to better
solution. Tag: Composite controls don't persist data? Tag: 101844
WindowsForms, ActiveX, Interop, GC
Hi all, i develop app in windows forms, in C#. I used WindowsForms yo host
ActiveX like, Flash, QuickTime, Quest3D, and so on. But i have a problem,
because when flash AxHost control uses lot of memory and i manually whant to
dispose and delete this object, the GC collector doesnt's recollect all the
memory. So my question is: Is there other way to Dispose a AxHostControl, o
WindowsForm to recover all the memory. Thanxs. Tag: Composite controls don't persist data? Tag: 101843
ToolStripMenuItem Child or Parent
Hi all
How can I determine if the ToolStripMenuItem is having child menus ?
Thanks
Nits. Tag: Composite controls don't persist data? Tag: 101842
Dynamic items to ContextMenuStrip and Text from sub-items?
How to add dynamically new item WITH subitems to ContextMenuStrip?
I already have designer edited ContextMenuStrip on the form but I need
to add some items with sub-items to it dynamically on runtime. How to
do that?
I can add normal items with
myMenu.Items.Add("My new item");
But I have no idea how to add Item with sub-items.
Other question is, how can I get "Text" from sub-items and those new
dynamically created sub-items? I know I can do
Point p = myMenu.PointToClient(new Point(Form.MousePosition.X,
Form.MousePosition.Y));
ToolStripItem pItem = myMenu.GetItemAt(p.X, p.Y);
this.Text = pItem.Text;
But it only give text from main items, not from sub-items.
Any ideas are apreciated, thank you. Tag: Composite controls don't persist data? Tag: 101838
IronPython & Windows Forms
Hello all,
IronPython [
http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython ] is a
great dynamic language for the .NET platform (and also works well on
Mono).
As well as being a great language, Python brings rapid application
development to .NET, without losing the power of the breadth of the
.NET API.
As an example of how easy it is to develop with IronPython, I am
writing a tutorial series on using Windows Forms from IronPython.
So far there are five entries :
* Introduction -
http://www.voidspace.org.uk/python/weblog/arch_d7_2006_05_20.shtml#e342
* Hello World -
http://www.voidspace.org.uk/python/weblog/arch_d7_2006_05_20.shtml#e343
* Widgets & Event Handlers -
http://www.voidspace.org.uk/python/weblog/arch_d7_2006_05_27.shtml#e344
* Panels & Styles -
http://www.voidspace.org.uk/python/weblog/arch_d7_2006_06_03.shtml#e351
* The Textbox Widget -
http://www.voidspace.org.uk/python/weblog/arch_d7_2006_06_03.shtml#e352
The series is still in it's early days. Comments and corrections
appreciated.
All the best,
Fuzzyman
http://www.voidspace.org.uk/python/index.shtml Tag: Composite controls don't persist data? Tag: 101837
Language detection
Hi there. I need to detect what languages are supported by an application
using the VS automation IDE (for a VS add-in). Unfortunately, I can't seem
to find any clean way of doing this other than searching for all (embedded)
resource files and checking for the appropriate language extension (e.g.,
"MyResource.[<LanguageExtension>].resx"). Does anyone know if there's a
cleaner way of doing this (none that I can find in the automation API so
far) and more importantly, how do you determine what the default language is
(since no language extension is present for default language resource
files). Thanks in advance. Tag: Composite controls don't persist data? Tag: 101836
NetworkChange does not work
http://msdn2.microsoft.com/en-us/library/system.net.networkinformation.networkchange.aspx
I am trying the vb.net example from above link. But it does not work for
me.
Does it atall works. Is it working for anybody.
I am using framework 2.0, Windowx XP
Steve. Tag: Composite controls don't persist data? Tag: 101834
Visual styles an .NET Framework 2.0
In .NET Framework 1.1 in order to enable visual styles we had to code:
Application.EnableVisualStyles();
Application.DoEvents();
before anything visual, and then set the FlatStyle attribute of the controls
to FlatStyle.System.
Is all these needed on version 2.0 in order to achieve the same behaviour
(XP like controls) ?
Thanks
Emmanuel Tag: Composite controls don't persist data? Tag: 101824
Sharing a component across multiple tabs
Hi,
I have an application where multiple TabPages (within the same
TabControl) need to contain the same components; switching tabs changes
the data source feeding into the components. I guess this is a problem
a lot of people have solved in the past, but I can't seem to get it to
work elegantly.
In my current implementation, each time I receive a "Selected" event
from the TabControl I switch over my data source, then add my data
panel to the newly-selected tab (which automatically removes it from
the previous tab). This works reasonably well, but the data grid
"flickers" irritatingly - I suspect because of the reparenting.
I have tried making the TabControl and the data panel children of the
same parent Panel, laid out so that the tabs abut the data panel, and
simply changing the data source when the tabs change. This avoids the
flickering problem - but unfortunately the 3D border of the TabPanel is
very visible, so it's obvious that the data panel is not on the
TabControl. If I could switch off the 3D border, this could look OK,
but I can't find any way to do that.
My final attempt was again to put the TabControl and the data panel on
the same parent Panel, but this time making sure that the data panel
was on top of the TabControl in the Z-order, and then listening for
Resize events from the TabControl and handling them by resizing the
data panel so that it precisely obscures the TabPanel. This *almost*
works, but (a) the resizing happens a bit too slowly, and is very
visible to the user, and (b) it feels really really hacky :-)
There *must* be a better way of doing this, can anyone help me out?
Cheers,
Giles Tag: Composite controls don't persist data? Tag: 101818
Using the ASP.NET 2.0 Profile in WinForms
Hi all,
We have an ASP.NET 2.0 web app which uses Profiles, and want to write a
little WinForms app to administer sections of the site.
In a little prototype, I was able to utilize Profile in the WinForms
app! I added this to my app.config:
<system.web>
<profile>
<properties>
<add name="FirstName" type="string" />
<add name="LastName" type="string" />
</properties>
</profile>
</system.web>
(So, it's using the default SQLExpress database/provider).
I then wrote this code in a form to create and save profile info:
Dim p As ProfileBase = ProfileBase.Create(txtUsername.Text)
p("FirstName") = txtFName.Text
p("LastName") = txtLName.Text
p.Save()
NOW, I do have one remaining question. When using Profile in ASP.NET,
ASP.NET somehow creates a "ProfileCommon" subclass of ProfileBase with
strongly-typed properties (as opposed to the non-strongly-typed
properties that I use above). Each Page's "Profile" property returns
this ProfileCommon.
How does ASP.NET create this ProfileCommon class - does it
code-generate it? Secondly, is there a way that I could make use of
the strongly-typed ProfileCommon class in my WinForms app? Tag: Composite controls don't persist data? Tag: 101817
Toolbar in a TaskBar like Windows Media player
I am trying to put a toolbar in the taskbar when the user minimizes the
application, something like windows media player where when you minimize it
puts the toolbar on the taskbar and you will be able to do some basic
operations on media player or bring back the window etc.
I would really appreciate any suggestions or pointers how to do this.
Thanks in Advance Tag: Composite controls don't persist data? Tag: 101816
Dock and Z-Order Problems
I have a lingering problem with control docking and z-order.
As I understand it, the control docking order based on the control z-order.
So If I have two controls, Control1 & Control2 whose Dock properties are both
set to Top, the control that is "Top Most" will appear on the top. I tried
changing
the z-order in the designer for Control2 by selecting bring to front, but
when I show
the form, Control1 appear on top.
Programatically, I tried settting the z-order by calling the BringToFront
method
and then changing the Dock as follows:
Control1.Dock = DockStyle.None;
Control2.Dock = DockStyle.None;
Control1.Location = new point (0,0);
Control2.Location = new point (0,0);
Control2.BringToFront();
Control1.Dock = DockStyle.Top;
Control2.Dock = DockStyle.Top;
But this still does not work. How do I set Control2 to be on Top of the form?
I hope I don't have to muck around with the designer generated code.
I am using .Net 2.0.
Thanks Tag: Composite controls don't persist data? Tag: 101813
MDI form and MessageBox
I have an MDI form with Child forms.
If I show a MessageBox from an MDIChild form and click any of the buttons on
the MessageBox my MDI Parent (and it's children) dissappear behind any other
windows I might happen to have open at the time.
Any Ideas? Tag: Composite controls don't persist data? Tag: 101812
TreeView TreeNode LabelEdit accepts only one character C++ VS2005
The following MDI Form only allows me to type one character in the
TreeNode's edit control unless the child window is focused in a Normal
(or Maximized) WindowState.
After entering one character the child form is appears to receive
focus, ending the edit operation. If there is more than one MDI child,
then the first child receives focus and is brought to front.
How can I fix this?
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::TreeView^ treeView1;
private: System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->treeView1 = (gcnew
System::Windows::Forms::TreeView());
this->SuspendLayout();
//
// treeView1
//
this->treeView1->Dock =
System::Windows::Forms::DockStyle::Left;
this->treeView1->LabelEdit = true;
this->treeView1->Location = System::Drawing::Point(0, 0);
this->treeView1->Name = L"treeView1";
this->treeView1->Size = System::Drawing::Size(200, 471);
this->treeView1->TabIndex = 0;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode =
System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(696, 471);
this->Controls->Add(this->treeView1);
this->IsMdiContainer = true;
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this,
&Form1::Form1_Load);
this->ResumeLayout(false);
}
#pragma endregion
private:
System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e)
{
Form^ f = gcnew Form();
f->MdiParent = this;
f->Show();
f->WindowState = FormWindowState::Minimized;
TreeNode^ tn = this->treeView1->Nodes->Add("Top1");
tn->Nodes->Add("sub1");
tn->Nodes->Add("sub2");
tn = this->treeView1->Nodes->Add("Top2");
tn->Nodes->Add("sub3");
tn->Nodes->Add("sub4");
tn->Nodes->Add("sub5");
tn = this->treeView1->Nodes->Add("Top3");
tn->Nodes->Add("sub6");
tn->Nodes->Add("sub7");
tn->Nodes->Add("sub8");
this->treeView1->ExpandAll();
}
}; Tag: Composite controls don't persist data? Tag: 101811
Collapsable Panel
Is there a control in 2.0 that can be used as a collapsible panel? Or do I
need to look at implementing my own or using a 3rd party control?
Thanks
Brian Tag: Composite controls don't persist data? Tag: 101804
New controls in .Net 2.0
Is there something online somewhere that demos all or most of the new
controls in 2.0? I've searched google and MSDN to no avail.
Thanks,
Brian Tag: Composite controls don't persist data? Tag: 101803
With DataDirectory Keyword: CrystalReports.Load, CrystalReports.SetDataSource Yields Password Prompt Which You Can Cancell And Still See Report! How To Stop Prompt
Hello, the step that I did to get to my current question are:
I began to use the keyword DataDirectory and the next line of code.
When I ran the application, I would be asked for a Login ID and
password. If I clicked the cancell button on that Login window I would
not see the report at all.
CrystalReport1.Load(Application.StartupPath &
"\..\..\CrystalReport1.rpt")
So, I eventually tried the following 2 line code sequece. This time
if I pressed the cancell button on the Login window it would show the
report.
CrystalReport1.Load(Application.StartupPath &
"\..\..\CrystalReport1.rpt")
CrystalReport1.SetDataSource(Employee_DatabaseDataSet)
Question: The last 2 lines of code will display the report and I'm
pleased with that. But, how can I stop the Login prompt? I want to just
open the report without being asked for Login ID or password.
Trying to finish-up a project,
Christopher Lusardi Tag: Composite controls don't persist data? Tag: 101799
Cann't Hide Main Form Window
Hi ,All
I have a small c# app, when It start, Hide it self to system tray.
but when I add:
public Form1()
{
InitializeComponent();
Hide();
}
or
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Hide();
}
they doesn't work,
How can I do ?,
thanks
--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/
_/ Nie Longhai , coder -_-|||
_/ Shanghai Xomi Instruments Co., Ltd.
_/ URL: http://www.xomi.cn
_/ Shanghai C&U Industrial Park
_/ Feng Cheng Town, Feng Xian District
_/ Shanghai, 201411
_/ Phone:86-21-57513966-807
_/ Fax:86-21-57513636
_/ Mobile:13162055440
_/ Email:NieLH@xomi.cn ,cok119@163.com
_/
_/ Profession & Focus
_/ High precision semiconductor metrology system vendor.
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ Tag: Composite controls don't persist data? Tag: 101796
XSD File and Database View
hi Guys!
i've faced very very strange problem. i don't know whether it is a
problem or its the feature of the .net 2.0. I'd made some Dataset using
XSD file. in this XSD files i've created 3 tables and defined some
constraint in them. i generated Data Adapter and everything was working
fine. Then i made change in the database. i added one column in the one
of the table and renamed the table and also created the view with the
previous name of the table so that my dataset work correctly. but what
surprised me is, my dataset didnt work. yeah, i spent hours to find out
the problem but all my R&D failed.
after lots of R&D i drop the view and again renamed the table and
everything started working back. and that surprised me.
My conclusion on this is :
-- if you have enforced constriant in the Dataset XSD files, then do
remember to modifiy tables in the file as you modify them in the
database
-- XSD file doesnt work with views. i mean if you have constraint
enabled then XSD failes to work with view as it only requires physical
tables so that constraint can be enfored.
I want your vies on my experienced because this is something i cant
find it anywhere and only experienced developers can tell me why, what
and how on this problem. please let me know if there is something i'm
missing.
thanks,
Lucky Tag: Composite controls don't persist data? Tag: 101794
Minus key on numpad not in Keys enumeration?
Hello Group,
i want to know how to handle the pressed key on the numpad? I found
Keys.OemMinus but this does only follow the pressed "normal" minus key
and not the minus key on the numpad.
There is Keys.Add for the plus key on the numpad and Keys.Oemplus for
the "normal" plus key.
Please help me - thanks.
Roland Tag: Composite controls don't persist data? Tag: 101786
Clipboard and custom data
hi,
there's some very strange with the clipboard (I'm using .NET 2.0). I
tried to set an object (type is inherited from TreeNode) to the
clipboard. This works fine but when I want to retrieve this object from
clipboard it doesn't work. It's strange because the GetDataPresent
methode returns "true" when I ask wether the requested type of object
is present at the clipboard. However getting the object returns "null".
Here's some code of my app:
// copy to clipboard
TreeNodeEx copy = (TreeNodeEx)treeCards.SelectedNode.Clone();
DataObject data = new DataObject();
data.SetData("Test", copy);
Clipboard.SetDataObject(data);
// paste from clipboard
TreeNodeEx t = Clipboard.GetDataObject().GetData("Test") as TreeNodeEx;
// type of the object
[Serializable]
class TreeNodeEx : TreeNode
{
[...]
}
Why doesn't this work?
Thanks for any help
Steffen Tag: Composite controls don't persist data? Tag: 101784
Buttonrendering, datagrid
Hi all,
When a cell of a datagrid is set to type combobox, it doesnt show the little
dropdown button until the actual cell is clicked. I want the cell to have
the button all the time, also when not clicked. As far as i know, the only
way to do this is to draw your own little button in the cell by using the
rendering.. this works fine, however i have drawn a normal button now, i
want an exact copy of a "combobox-button". Does anyone have any idea how to
accomplish this? The normal button i get using following code.. It is gray,
which should be lightblue and i use a "v" to show on the button, which isnt
ideal either..
Many thanks for any suggestions.
Albert
Dim clickrectangleValue As New Rectangle
With clickrectangleValue
.X = e.Bounds.X + (0.75 * e.Bounds.Width)
.Y = e.Bounds.Top + (0.05 * e.Bounds.Height)
.Width = e.Bounds.Width * 0.25
.Height = e.Bounds.Height * 0.9
End With
ButtonRenderer.DrawButton(e.Graphics, clickrectangleValue, "v", Me.Font,
False, state) Tag: Composite controls don't persist data? Tag: 101783
Uninstaller Help
Hi everyone, is it posible to assing a custom uninstaller to your
application?.. i mean.. that if you choose to uninstall your software
in control panel's add/remove programs, that uninstaller that you did
will execute? Tag: Composite controls don't persist data? Tag: 101778
About MultiThread in Form
Hi ,All
I'm a newbie for c#, I have a question about MultiThread in C# and Form,
In .Net 2.0, the Form cann't be access by other thread, but
when I start a new thread using follow code:
Thread newThread = new Thread(MyFormInstance.method)
compile and run OK,
why this Form instance can be access by two thread(main thread and
newThread)
and no exception occured?
thanks for any advice
--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/
_/ Nie Longhai , coder -_-|||
_/ Shanghai Xomi Instruments Co., Ltd.
_/ URL: http://www.xomi.cn
_/ Shanghai C&U Industrial Park
_/ Feng Cheng Town, Feng Xian District
_/ Shanghai, 201411
_/ Phone:86-21-57513966-807
_/ Fax:86-21-57513636
_/ Mobile:13162055440
_/ Email:NieLH@xomi.cn ,cok119@163.com
_/
_/ Profession & Focus
_/ High precision semiconductor metrology system vendor.
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ Tag: Composite controls don't persist data? Tag: 101776
Performance issue due to Background image
I have my base form which has background image , tool bar etc,All other
forms inherit it. The background image size is 34kb and it is in Jpeg
format.All the other forms also has many images since we have unique look and
feel. The issue I am facing is performance .
Application works fast when I don't have background image on my base form (
in turn we don't have any background image for any of the form), But when I
apply background image for the base form or individual form , screen loads
slowly ie.. the controls on the screen loads slowly .
is there any way to overcome this problem
Technology - Windows form in VB.Net Tag: Composite controls don't persist data? Tag: 101769
clickonce async wait
I want to do an async update with clickonce.
The main reason is so I can get the
DeploymentProgressChangedEventArgs (bytes downloaded etc.)
and update the UI.
What is the best way to wait in the main thread until the
CheckForUpdateCompleted event fires.
thanks, Tag: Composite controls don't persist data? Tag: 101768
Professional Toolstrip Renderer
Is there a simple method to set the renderer to one of the three standard XP
themes without having to set each property?
I want to give the user the option (on pre XP systems) to set the
application style to one of the XP themes.
Thanks. Tag: Composite controls don't persist data? Tag: 101767
Windows Form Application Authentication in .NET 2.0
Hi,
I am trying to implement ActiveDirectory Authentication for Windows
Form Application in .NET 2.0. I am not getting much help regarding
WinForms with ActiveDirectory, but most of the information telling
about ASP.NET with Active Directory.
Can any one please point me to the right information.
Thank you!
Suresh Tag: Composite controls don't persist data? Tag: 101765
Drag and Drop Outlook attachment into a Windows Form Control
I previously performed drag and drop between 2 lists within a Windows form.
Right now I am looking for something a little more complex and I am not able
to find a way to do it.
In just few words, I want to drag a file (in my case a PDF file) which is an
attachment to an email in Outlook 2003 client and drop it over a control (in
my case a command button or anything else) within a window in my application.
When file is dropped over my designated control, I do not need to open it I
just want to save it into a SQL database. Saving files in SQL databases is
not an issue because I am already doing it, my only problem is I don't know
how to capture the dropped file into a variable in order to be afterwards
able to save it into the database.
The same question would apply for other formats too (e.g. BMP, JPG, TIFF,
DOC, XLS, etc.) if each type should be handled in a different way.
I appreciate any hints into this issue.
Thanks,
Adrian Tag: Composite controls don't persist data? Tag: 101764
Using vbTab to create tsv files
I'm attempting to create a tsv file (i.e. equivalent to what Excel produces
when you use the Text (tab delimited) type when saving. I'm trying this...
Dim sw As New System.IO.StreamWriter("c:\test.tsv")
sw.Write("sdfdsf" + vbTab + "dsfsd")
sw.Close()
...but the output of that is gibberish. Anyone how to do this? Tag: Composite controls don't persist data? Tag: 101758
Data binding to a NUmbericUpDownBox
I have 1 row of data in data set and want to bind to a numeric box. I
figured that nUpDwnMin1.DataBindings.Add("Value", ,"Min_1"); but I
having an issue figuring out the source notation.
Unfortunately, I am getting confused about setting the value from the
data set. I created all my tables with table[0].
Do I have to use a get and set statement for the valuesl in the class?
Can I directly load from the dataset? Also, these are numbers that
will be updated that's why I decided to use a dataset to write back
easily? This data set only contains 1 record. I put the code below to
see if I am going over board.
Any help is greatly appreciated.
Mark
//Call over
private void Load_CodeAssignments()
{
DataTable dt = new DataTable();
Codes dsCodes = new Codes(cbDept.Text, cbPyramid.Text);
dt = dsCodes.Get_Codes;
//nUpDwnCodeA.Value = dsCodes.Get_Codes.Columns["A_pct"]; No good
//nUpDwnMin1.Value = Convert.ToDecimal(dt.Columns["Min1"]); No good
nUpDwnMin1.DataBindings.Add("Value", ,"Min_1");
}
//Class
public class Codes
{
#region Private Members
private DataSet _dsCodes;
#endregion
#region Public Properties
public DataTable Get_Codes
{
get { return _dsCodes.Tables[0]; }
}
#endregion
#region Constructors
public Codes(string Department, string Pyramid)
{
//This will establish the database connection
Database db = DatabaseFactory.CreateDatabase("Test");
//This will allow you to call a SP and use parameters
DBCommandWrapper dbc =
db.GetStoredProcCommandWrapper("usp_Inv_SS_GetCodes");
dbc.AddInParameter("@Department", DbType.String, Department);
dbc.AddInParameter("@Pyramid", DbType.String, Pyramid);
_dsCodes = db.ExecuteDataSet(dbc);
}
#endregion Tag: Composite controls don't persist data? Tag: 101753
treeview
I have a treeview wist several nodes
each node has its own context menu
for now, every menuitem in theese menues has the same code:
msgbox (treeview1.selectednode.name.tostring,okonly)
the problem is that every i click on the menuitem the message box shows
me name of the node that was selected before rightclick and thet node
is stil selected.
how do i get node name of the node where right click happened? Tag: Composite controls don't persist data? Tag: 101746
Program stuck when removing row from DataTable
Hello
I have built a DataGridView that its data source is binded to a DataTable
after adding it 200 rows I try to remove the first row and the program
stuck, What could it be????
Thanks. Tag: Composite controls don't persist data? Tag: 101740
ClickOnce error
After a few problems with my windows account (was deleted and then made it
again with the same name) I can't update my app with ClickOnce.
The error is
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later
in the log.
* Activation of C:\Documents and Settings\john\Start
menu\Programs\john\contacts.appref-ms resulted in exception. Following
failure messages were detected:
+ The referenced assembly is not installed on your system. (Exception from
HRESULT: 0x800736B3)
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
* [08.06.2006 11:07:55] : Activation of C:\Documents and
Settings\john\Start menu\Programs\john\contacts.appref-ms has started.
ERROR DETAILS
Following errors were detected during this operation.
* [08.06.2006 11:07:55] System.Runtime.InteropServices.COMException
- The referenced assembly is not installed on your system. (Exception from
HRESULT: 0x800736B3)
- Source: System.Deployment
- Stack trace:
at
System.Deployment.Internal.Isolation.IStore.GetAssemblyInformation(UInt32
Flags, IDefinitionIdentity DefinitionIdentity, Guid& riid)
at System.Deployment.Internal.Isolation.Store.GetAssemblyManifest(UInt32
Flags, IDefinitionIdentity DefinitionIdentity)
at
System.Deployment.Application.ComponentStore.GetSubscriptionStateInternal(DefinitionIdentity
subId)
at
System.Deployment.Application.SubscriptionStore.GetSubscriptionStateInternal(SubscriptionState
subState)
at
System.Deployment.Application.ApplicationActivator.ProcessOrFollowShortcut(String
shortcutFile, TempFile& deployFile)
at
System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri
activationUri, Boolean isShortcut)
at
System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object
state)
What assembly is about and how can I correct this ? Tag: Composite controls don't persist data? Tag: 101732
How to place border to the item selected in the listbox?
Hi All,
I'am using Vb.net 2005.I want to develop an application in which I have
listbox control with 2 columns in it. In first column string is
displayed and in other column colored labels are displayed. Now
whenever i select item from a listbox it shows blue color filled into
that row. Instead of this i want whenever user selects item from
listbox some rectangular border is placed thorugh the item.
For a look it is there in Microsoft publisher color scheme.
Please let me know how to do it.
Thank You in advance.
-Manju Tag: Composite controls don't persist data? Tag: 101731
I made a composite control (TitleBar) consisting of an ImageBox, a Panel,
and a Label. The Text property of TitleBar just gets or sets the property of
the Label's text: