|
in my project i have three forms.
in form1 there are two buttons.if we click one button form2 will display and this form should be closed.and in form3 i have one button when we click form1 will display and this form will closed.
how can i handle this withou creating the objects.thanking you.
|
|
|
|
|
rizwan1 wrote: withou creating the objects
Not sure what you mean by this.
If you have several forms and only one should show at a time, the best way is to create the forms as controls, and show them all, one at a time, on the one form.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm looking for a control for Winform which like DayPilot,But DayPilot is only for webform.
I want to use the scheduling function in my winform applications.
Free Component is best.
Could anyone Help or give me any tips ? Thanks.
|
|
|
|
|
Hi everyone,
Does anybody know how to list all tollStripMenuItems of a MenuStrip
Thanks
Paulo
|
|
|
|
|
You may access each ToolStripMenuItem which are under main menu strip, using 'for each' structure of code. Following is a small code snippet which will return you all items of a given menu strip object-
----------------------------------------------
For Each MnuItm As ToolStripMenuItem In Me.MenuStrip1.Items
MsgBox(MnuItm.Text)
For Each DropItm As ToolStripMenuItem In MnuItm.DropDownItems
MsgBox(DropItm.Text)
Next
Next
-----------------------------------------------
I hope this helps.
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Hi friends.
How to add contextmenu in form titlebar..
modified on Thursday, February 28, 2008 1:55 AM
|
|
|
|
|
See here: http://www.codeproject.com/script/Forums/View.aspx?fid=387161&msg=2446210
www.wickedorange.com
www.andrewvos.com
|
|
|
|
|
Hi
I'm trying to use a separate form with a webbrowser control on it to show context-sensitive help for my application (don't ask why I don't use the Help class plz). Let's call this form HelpBrowser. When the user requests help for the first time, HelpBrowser is created from the main thread and shown using HelpBrowser.Show() as I want it modeless.
This all works fine except for this; if the HelpBrowser is already open and the user opens a dialog box (modal form) from the main form, HelpBrowser can not be accessed by user anymore as long as the dialog box is open (it can no be moved, resized, scrolled, etc. anymore but it still shows new help if user requests it). I guess this is because the modal dialog box freezes all other open forms while it is open. However, if HelpBrowser is opened for the first time from a dialog box everything works fine.
Is there a way to keep control of the HelpBrowser form at all times even when a dialog box is opened from the main form, while still keeping everything in one process? Passing the main form as an argument when calling Show doesn't make any difference.
Thanks
|
|
|
|
|
The way most apps handle this is to make the help type program, a seperate program. That's what VS does, for example.
A modal dialog is going to stop any other dialog in the same application from responding.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I see.
What then would be a good way to send help requests to the Help program?
Thanks.
|
|
|
|
|
Hello I'm a newbie in form design
I'm trying to figure out how a toolstripSplitButton can be used in a toolstrip
Can I found some example ?
|
|
|
|
|
Hi,
ToolStripSplitButton is used to provide several option under a single button (similar to MenuItems).
Each option can be coded to perform certain taks on click events. Below is the code snippet which creates ToolStripLabel,ToolStripSplitButton,ToolStripComboBox,ToolStripProgressBar etc.
BEGIN CODE
Imports System
Imports System.Data
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Data.SqlClient
public class MainClass
Shared Sub Main()
Dim form1 As Form = New Form1
Application.Run(form1)
End Sub
End Class
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Public Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.ToolStrip1 = New System.Windows.Forms.ToolStrip
Me.ToolStripButton1 = New System.Windows.Forms.ToolStripButton
Me.ToolStripLabel1 = New System.Windows.Forms.ToolStripLabel
Me.ToolStripSplitButton1 = New System.Windows.Forms.ToolStripSplitButton
Me.ToolStripDropDownButton1 = New System.Windows.Forms.ToolStripDropDownButton
Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator
Me.ToolStripComboBox1 = New System.Windows.Forms.ToolStripComboBox
Me.ToolStripTextBox1 = New System.Windows.Forms.ToolStripTextBox
Me.ToolStripProgressBar1 = New System.Windows.Forms.ToolStripProgressBar
Me.ToolStrip1.SuspendLayout()
Me.SuspendLayout()
'
'ToolStrip1
'
Me.ToolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripButton1, Me.ToolStripLabel1, Me.ToolStripSplitButton1, Me.ToolStripDropDownButton1, Me.ToolStripSeparator1, Me.ToolStripComboBox1, Me.ToolStripTextBox1, Me.ToolStripProgressBar1})
Me.ToolStrip1.Location = New System.Drawing.Point(0, 0)
Me.ToolStrip1.Name = "ToolStrip1"
Me.ToolStrip1.Size = New System.Drawing.Size(647, 25)
Me.ToolStrip1.TabIndex = 0
Me.ToolStrip1.Text = "ToolStrip1"
'
'ToolStripButton1
'
Me.ToolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.ToolStripButton1.Image = New Bitmap("figure2.bmp")
Me.ToolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta
Me.ToolStripButton1.Name = "ToolStripButton1"
Me.ToolStripButton1.Text = "ToolStripButton1"
'
'ToolStripLabel1
'
Me.ToolStripLabel1.Name = "ToolStripLabel1"
Me.ToolStripLabel1.Text = "ToolStripLabel1"
'
'ToolStripSplitButton1
'
Me.ToolStripSplitButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.ToolStripSplitButton1.Image = New Bitmap("figure2.bmp")
Me.ToolStripSplitButton1.ImageTransparentColor = System.Drawing.Color.Magenta
Me.ToolStripSplitButton1.Name = "ToolStripSplitButton1"
Me.ToolStripSplitButton1.Text = "ToolStripSplitButton1"
'
'ToolStripDropDownButton1
'
Me.ToolStripDropDownButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.ToolStripDropDownButton1.Image = New Bitmap("figure2.bmp")
Me.ToolStripDropDownButton1.ImageTransparentColor = System.Drawing.Color.Magenta
Me.ToolStripDropDownButton1.Name = "ToolStripDropDownButton1"
Me.ToolStripDropDownButton1.Text = "ToolStripDropDownButton1"
'
'ToolStripSeparator1
'
Me.ToolStripSeparator1.Name = "ToolStripSeparator1"
'
'ToolStripComboBox1
'
Me.ToolStripComboBox1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText
Me.ToolStripComboBox1.Name = "ToolStripComboBox1"
Me.ToolStripComboBox1.Size = New System.Drawing.Size(121, 25)
Me.ToolStripComboBox1.Text = "ToolStripComboBox1"
'
'ToolStripTextBox1
'
Me.ToolStripTextBox1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText
Me.ToolStripTextBox1.Name = "ToolStripTextBox1"
Me.ToolStripTextBox1.Size = New System.Drawing.Size(100, 25)
Me.ToolStripTextBox1.Text = "ToolStripTextBox1"
'
'ToolStripProgressBar1
'
Me.ToolStripProgressBar1.BackColor = System.Drawing.Color.Black
Me.ToolStripProgressBar1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText
Me.ToolStripProgressBar1.Name = "ToolStripProgressBar1"
Me.ToolStripProgressBar1.Size = New System.Drawing.Size(100, 22)
Me.ToolStripProgressBar1.Text = "ToolStripProgressBar1"
Me.ToolStripProgressBar1.Value = 66
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(647, 125)
Me.Controls.Add(Me.ToolStrip1)
Me.Name = "Form1"
Me.Text = "UseToolstrip"
Me.ToolStrip1.ResumeLayout(False)
Me.ToolStrip1.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents ToolStrip1 As System.Windows.Forms.ToolStrip
Friend WithEvents ToolStripButton1 As System.Windows.Forms.ToolStripButton
Friend WithEvents ToolStripLabel1 As System.Windows.Forms.ToolStripLabel
Friend WithEvents ToolStripSplitButton1 As System.Windows.Forms.ToolStripSplitButton
Friend WithEvents ToolStripDropDownButton1 As System.Windows.Forms.ToolStripDropDownButton
Friend WithEvents ToolStripSeparator1 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents ToolStripComboBox1 As System.Windows.Forms.ToolStripComboBox
Friend WithEvents ToolStripTextBox1 As System.Windows.Forms.ToolStripTextBox
Friend WithEvents ToolStripProgressBar1 As System.Windows.Forms.ToolStripProgressBar
End Class
END CODE
I hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
Hi I am crating windows application ,Here i am able to insert the data
sql to Excel but i have to apply the formulas like (=exact(A1:b1))so i have to insert according to the conditions
pls help me
|
|
|
|
|
I'm so glad it's urgent for you. I'll make sure I put it at the top of my "don't give a sh*t pile". Why don't you google Excel automation.
|
|
|
|
|
web form's DataGridview has itemtemplate. There we can define how my datagrid loooks like. And which controles used for which columns(Name: textbox,Gender: comboBox etc...)
I want similar feature for windows form's datagrid. Give me some articles on this..
Thanks
Rajesh A
|
|
|
|
|
The two classes are very different. There's tons of articles on Code Project on using both
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi,
i want to show checkbox near headertext column of datagrid in VB.NET window application.how to do it?send me code plz
|
|
|
|
|
chellam.r wrote: i want to show checkbox near headertext column of datagrid in VB.NET window application.how to do it?send me code plz
Ummm, no. That's not how it works around here...
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Hi,
I have 1 WindowsForm with 2 BackGround Workers.
Each BGW runs a process.
Each BGW has its own DatagridView and textbox as display ouptut when the ProgressChanged eventhandler is called.
So I see to textboxes running with text to see how far each process is.
My problem now is that when I click on my Form or on the Windows Desktop and than on my program again the windows form freezes, says (Not Responding). In the taskmanager I can see the program is still running.
After 10 minutes or so the application continues with show logtextx in the textboes en show how manu rows were proccessed.
How can I solve thi sproblem. I want the program to continue working if I click on the form.
|
|
|
|
|
Hi,
only the thread that creates a Control (Form, DGV, ...) is allowed to access it; all other
threads (such as BGW) should keep off, i.e. they need to use Control.InvokeRequired and
Control.Invoke to tell the owning thread to perform the access.
If not, either the GUI may/will freeze, the app will crash, or (since .NET 2.0) you will
get an illegal-cross-thread exception (which you can hide, but you can't hide the freezing
effects).
There are lots of articles on InvokeRequired etc., both on CodeProject and Google.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
This is strange!
I am using the backgroundworker. The UI Thread starts the BackGroundWorker in a new thread.
The BackGroundWorker has 2 events called ProgressChangedEventHandler and RunWorkerCompletedEventHandler but they run in the GUI-Thread. By using the method ReportProgress(0) of the BackGroundWorker it is possible to update GUI-components in the ProgressChangedEventHandler.
No need for Control.InvokeRequired in here. And by using this way of BackGroundWorker no Illegal-Cross-Exceptions occur.
In the BackGroundWorker you must check if (BackGroundWorker.CancellationPending.Equals(true)) and then you can set the e.Cancel object.
Can a backgroundprocess consume so much from a pc (my processor show 30% usage) that the Form-Buttons freeze?
|
|
|
|
|
Hi,
which threads starts the BGW is irrelevant; the BGW always runs its own thread, which is
different from the GUI thread.
yes, ProgressChangedEventHandler and RunWorkerCompletedEventHandler will be run by
the GUI thread, no problem inside those handlers.
however, if your BGW itself tries to access Controls, a freeze is likely to occur.
MSDN says "You must be careful not to manipulate any user-interface objects in your
DoWork event handler. Instead, communicate to the user interface through the
ProgressChanged and RunWorkerCompleted events."
digimanus wrote: Can a backgroundprocess consume so much from a pc (my processor show 30% usage) that the Form-Buttons freeze?
AFAIK no, unless you manage to change the relative thread priorities.
Final thought: what is in your GUI code right after starting the BGW? You are not
waiting somehow for it to finish, do you?
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
{
try
{
txtInfo.Text = String.Empty;
txtInfo2.Text = String.Empty;
MeldingenNaarStatus1 = String.Empty;
MeldingenNaarStatus2 = String.Empty;
button1.Enabled = false;
button2.Enabled = true;
naarMultizorgStat0.Open();
naarMultizorgStat1.Open();
naarMZ2.Open();
naarNDFACC.Open();
naarNDFACC2.Open();
bgwNaarStatus1.RunWorkerAsync();
bgwNaarStatus2.RunWorkerAsync();
}
catch (Exception err)
{
tssLabel1.Text = err.Message;
}
}
Hi Luc,
I do not touch any GUI object in the BGW.
In the BGW I fill a String-object with text.
In the report progress I fill the txtInfo.Text with the filled String Object.
If the String object > 20000 characters or the multiline TextBox txtInfo is over 100 lines, the txtInfo.text is set to String.Empty;
This is done in the reportprogress
If the BGW is finished it runs the RunWorkerCompleted-eventhandler.
Has it to do with the fact I am using 2 BGW's?
The first BGW checks for 600000+ records if the status is 0, check in another database if he can find the relative and set status to 1 (if found) or -1 if not found.
This process is done by 10000 database rows.
The second proces checks for all records with Status=1 if the financial numbers are in the database.
If found an agreement for the financial numbers Status will become 2 otherwise an angreement, a payment and so on will be insert in the database.
This is done in batches of 25 records unless BGW 1 is finished (a Boolean will tehn be true).
Batches will than have a size of 1000 rows.
Is this just to much for .NET?
|
|
|
|
|
Hi,
there is nothing fundamentally wrong it what you told here; this could work just fine.
The amount of work is actually irrelevant: when implemented properly the GUI should stay
alive and responsive at all times, and all the work is done, well, in the background.
Now here is maybe a clue: if one of your BGWs is keeping the database very busy
(and if the DB is on another machine, it would not show in your client's CPU activity),
then any other DB request may be delayed for quite some time. Now lets assume something
else in the GUI thread is trying to do a DB access too, that could temporarily
slow down the GUI so it looks frozen, no longer shows the menu bar, whatever.
And that something could be a Window.Forms.Timer doing some simple job periodically...
Of course this is just a hunch; anyway, I suggest you look for an indirect way in which
the GUI gets hampered by the BGW (stealing too many CPU cycles due to thread priority,
stealing DB bandwitdh, a locked object, a locked file, whatever).
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Both BGW connect to 2 different Database on different machines.
Process 1 is a fast one but the second is a time consuming one.
It has to check in 11 tables in 1 query. If that gives two rows of result the next agreement has to be found.
I use about 100 queries for determining the proces for 1 DBC in an arraylist.
What I do each time is to add an object in an arraylist. Based on the data in the datareader containing 25 or 1000 lines for proces 2 and 10000 lines for proces 1.
I did create an OnActiveChanged event for the Form and if I add Application.DoEvents(); The freeze get a bit less.
That's all!
Small Test results
I did check the DatabaseServer that will receive the information via Insert INTO sql's.
When I start my program the Database is at 0%. As soon as I hit the Start button the CPU for SqlServer raises up to 40-50%. It stays stable until I press the Cancel button.
My program freezes and the SqlServer user 70-80%........
This is NOT funny
modified on Tuesday, February 26, 2008 11:08 AM
|
|
|
|