|
Hi,
if all the code you've shown is running on the GUI thread (say inside a
button_click handler) then none of it will have a visible effect, since
the GUI actions will get queued until your code reaches its end: it is only
when the GUI thread is done dealing with the button click that it can start executing the queued stuff in a hurry.
Do you really want to show a form and (almost immediately) close it again??
Normally a form gets closed by an explicit user action, such as clicking
an OK button or the close box.
Remedy: reorganise your code, at least separate the Form.Close from everything
else (use another event, such as a button click, a timer tick, whatever).
BTW: DO NOT include delays in handlers, don't try Thread.Sleep() inside a
button click handler, it does not make any sense whatsoever.
Mind you there is one dangerous hack that may or may not be useful here:
include some Application.DoEvents() calls; they are bound to cause weird
effects if used inappropriately though.
|
|
|
|
|
There shouldn't be a button window close handling.
This should be a status window running while actions (calling C# methods and functions) are running. That's why it should be opened when actions start and closed when finished.
|
|
|
|
|
Try inserting
frm_Form.Invalidate()
when you want the form to update/refresh itself. (I wouldn't do this after every single content change, but probably after a group of updates). Invalidate() doesn't immediately update the form, but is usually sufficient. If Invalidate() doesn't update it when you expect, try calling
frm_Form.Refresh()
From my understanding, Refresh() prompts an immediate redraw of a form (although I could be mistaken).
Brandon
|
|
|
|
|
Tried Refresh() and worked , Invalidate didn't do it Form won't only be displayed correctly in debugging mode. But that's ok.
The best way of practise would be if I can do a periodical refresh on the form. But use of form object in Timer section and TimerElapsedEventHandler at the same time produces an error saying refresh can't be done when form is in both sections. If the user switches away and back to the program it seems as if the app has hung up. Because it's waiting for finishing the current process.
|
|
|
|
|
Hi ;
I want to send and receive msgs using SIM .
I created an App. and I want to add a feature to it .. like sending a msg to specified number...
actually, what I want to do is , when I send a msg "OFF" to my PC from anywhere , I want it to shutdown .
Just I want to know how can I send and receive , plz ?! (VB.net)
|
|
|
|
|
I have a datagridview bound to a dataview.
The user click on a column :
- add a sort column type system.int
- set the dataview.sort to the column field clicked
- add several datarows to the datatable ( partial total row )
- while adding the total rows update the column added at the beginning to a numeric sequential value ( 1,2,3,4,....)
- when the rows end change the dataview.sort to the sort column
If the user click to another column :
- delete the rows that contains the total
- redo everything for the new column that the user click on it
The problem is that everything is ok, because I see in the datagrid the sort column added with the sequential correct value, but the dataview doesn't update .
Can someone help ?
Regards
Andrew
|
|
|
|
|
hi
im currently working on a project that requires me to print a card,the card is a usercontrol with come labels on it with a backroundImage as a bitmap file and a color card printer ,the problem is when i print it only prints the labels and not the backround ,so i have a white backround with my labels ,i tried it on a normal paper color printer and it still does not work.
any help would be much appreciated
thanks
regards paula
|
|
|
|
|
Why don't you just create a usercontrol that can custom paint an image with the labels and background image? That way you do not need to rely on some painting of multiple controls.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
i am trying to create a schedule control where you can add/edit/delete appointments, select
start and end hour, have a day or week view....
I have been doind some research on it but no luck
I hope some one can help me
Thanks in advance
|
|
|
|
|
there is a schedular control here on CP
http://www.codeproject.com/KB/custom-controls/schedule.aspx
(sorry chrome won't allow me to post it as a link )
|
|
|
|
|
plz check the below code.i am trying to drag a node from a tre view and drop it into a textbox
the code didnt show me any error but i coudnt drop the node to the textbox.
private void treeView2_DragEnter(object sender, DragEventArgs e)
{
treeView2.DoDragDrop(treeView2.Nodes, DragDropEffects.Copy);
}
private void textBox7_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.Text))
e.Effect = DragDropEffects.Copy;
}
private void textBox7_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
textBox7.Text = e.Data.GetData(DataFormats.Text).ToString();
}
plz anybody tell me wat the error is
|
|
|
|
|
tracywitty wrote: if (e.Data.GetDataPresent(DataFormats.Text))
My first guess would be that Text data is not present. You can use tracing ( ) to see all the formats in the Data.
foreach (string s in e.Data.GetFormats())
Debug.WriteLine(string.Format("DragEnter: {0}", s));
led mike
|
|
|
|
|
If you're using sample code to figure out how to do drag/drop in a treeview, you need to do your best to follow that sample code EXACTLY.
One thing no documentation will ever tell you is that drag/drop actually invokes into the COM world under the covers, and any data errors or exceptions thrown there will never be seen by your code - it will just appear to not work and you won't know why.
In other words, you need to understand very clearly what you are doing when implementing drag/drop - it's relatively straightforward in .NET, but has some pitfalls you need to be aware of.
|
|
|
|
|
I am using 'ADOX.Catalog' namespace and the following code to create a new MS Access database.
Private Function CreateAccessDatabase() As Boolean
'-------------------------------------------------------
'This method is called to create a new Access database
'Required: NewDBConnectionString
'-------------------------------------------------------
Dim ADOXCatalog As New ADOX.Catalog
Try
If Me.NewDBConnectionString.Trim.ToString.Length = 0 Then Throw New Exception("Connection string is not specified")
'Call create method to create a new database
ADOXCatalog.Create(Me.NewDBConnectionString.Trim.T oString)
Return True
Catch ex As Exception
Throw ex
Return False
Finally
If Not ADOXCatalog Is Nothing Then
ADOXCatalog = Nothing
End If
End Try
End Function
The moment it created database, it is also leaving a .ldb file in the same directory. I don't want that .ldb file. If I tried to delete the file forcedly, it is passing an exception "The file is being used....". All the connection strings are properly closed.
Can anyone help me to remove this .ldb file.
|
|
|
|
|
The LDB file keeps track of all connections to the database. You cannot remove it. It will disappear as soon as the last connection to the database gets disconnected.
|
|
|
|
|
Hi ,
I am using .rdlc report in c# with reportviewer, when i run the applicaton it sows only one record in report.
can anyone hlp me out
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
|
Hello Friends,
I'm using a CheckedListBox in my project which is having checkboxes with their file name. An i want to show the checked file name into another ListBox. But I'm having some problems.
First, For checking a checkbox i've click double on a checkbox.So i'm not getting where should i place my code for checking the checkbox at a single click.........
Seconds, i've a variable sum=0 i want to add 1 in variable sum as the checkboxes are checked........... It's working fine but when i check my first record it shows 0 and when i check my second checkbox then it shows 1 but it must be 2 at the moment......................
|
|
|
|
|
First off, why don't you just have a button that will transfer all checked listboxes to the other listbox.
Second, this.chkListBoxs.CheckedItems.Count.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
I want to develop an application which can enter username and password to another application, for example from my custom application on press of a button username and password placed into msn messenger's username and password if msn messenger is open and its login screen too.
Thanks
|
|
|
|
|
Good luck.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Great idea. When you have it working you could post an article and share your knowledge with the rest of us.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
i'm working on a database client. i would like users to be able to view multiple tables and run multiple queries in tabs.
each tab will contain a text box (query input) a button (not so necessary) and the datagrid (to display results.)
how do i go about this? here's what i have, but it works only the first time. the others just open blank tab pages without the controls. quess the control names have an effect there...
private void newQueryToolStripMenuItem_Click(object sender, EventArgs e)
{
tabMain.TabPages.Add("1", "New Query", "app_tables");
SplitContainer split = new SplitContainer();
split.Dock = DockStyle.Fill;
split.FixedPanel = FixedPanel.Panel1;
split.Orientation = Orientation.Horizontal;
TextBox text = new TextBox();
text.Dock = DockStyle.Fill;
text.Multiline = true;
text.ScrollBars = ScrollBars.Both;
split.Panel1.Controls.Add(text);
DataGrid dgrid = new DataGrid();
dgrid.Dock = DockStyle.Fill;
split.Panel2.Controls.Add(dgrid);
tabMain.TabPages["1"].Controls.Add(split);
tabMain.TabPages["1"].ImageKey = "app_server";
this.PerformLayout();
}
|
|
|
|
|
nevermind... got it figured out. added a name property to the controls using GIUD.
private void newQueryToolStripMenuItem_Click(object sender, EventArgs e)
{
string key = Guid.NewGuid().ToString();
tabMain.TabPages.Add(key, "New Query", "app_tables");
SplitContainer split = new SplitContainer();
split.Name = key;
split.Dock = DockStyle.Fill;
split.FixedPanel = FixedPanel.Panel1;
split.Orientation = Orientation.Horizontal;
TextBox text = new TextBox();
text.Name = key;
text.Dock = DockStyle.Fill;
text.Multiline = true;
text.ScrollBars = ScrollBars.Both;
split.Panel1.Controls.Add(text);
DataGrid dgrid = new DataGrid();
dgrid.Name = key;
dgrid.Dock = DockStyle.Fill;
split.Panel2.Controls.Add(dgrid);
tabMain.TabPages[key].Controls.Add(split);
tabMain.TabPages[key].ImageKey = "app_server";
this.PerformLayout();
}
now is time to add event handlers.
|
|
|
|
|
I want to know how to close the windows form when Esc button is pressed.
Rangasamy
|
|
|
|