|
Hi,
Yes, I was thinking it would be somthing along the lines of some Invoke method. But would really BeginInvoke be a good choice? That's an asynchronous call and I need the user settings from the dialog right after showing it. Would I get myself into trouble if I used the blocking Invoke instead?
thanks
gasoltub
|
|
|
|
|
I've only used BeginInvoke/Invoke to quickly update controls on a form. So, I really don't know. But I don't forsee any issues.
I agree with you. I'm thinking Invoke will probably be better in this case. Of course, you should still watch out if your modal dialog changes any data belonging to the worker thread, even when using a blocking Invoke() call. As a general rule, any calls used to manipulate data belonging to another thread should always be make thread safe to help prevent possible race conditions.
|
|
|
|
|
It wouldn't modify any data in the worker thread. It would only modify it's own member fields which would then be accessed from the worker thread after the user has closed the dialog. So I don't think race conditions would be an issue here.
|
|
|
|
|
Hi,
I have a VS2003 application project (not webproject) which I have converted to a VS2005 project.
In VS2003 the project works perfect but in VS2005 I get this error.
Error:
System.ObjectDisposedException was unhandled
Message="Safe handle has been closed"
Source="System"
ObjectName=""
StackTrace:
at System.Net.UnsafeNclNativeMethods.OSSOCK.shutdown(SafeCloseSocket socketHandle, Int32 how)
at System.Net.Sockets.Socket.Shutdown(SocketShutdown how)
at ᐂ.Finalize()
This error occurs when trying to open a MySqlConnection.
I use the .Net Connector 1.0.7.
I have tried both 1.1 and 2.0 versions of the connector. It doesn't work with either of them.
Any suggestions?
// regards Patrik
|
|
|
|
|
Using VS 2003 to create Window Applications
I would like to do something simulary to the TabControl has, but with the Tabs as buttons inside the center of the panel and not on top.
The parent class called frmMain which has some buttons on the panel and when a button is clicked calls the class frmButtonPushed1 and places that panel onto the parent panel exactly. If frmButtonPushed2 is pressed then that class info would be placed on teh parent panel exactly ect.
Would like to get all the infomation in frmButtonPushed class and placed in
frmMain panel. So when frmMain panel is moved so will the new
displayed info from frmButtonPushed class. Do not want another window poping up.
For example on the frmMain Class panel has the following buttons to click:
--------------------
ButtonClick1
ButtonClick2
ButtonClick3
--------------------
By clicking ButtonClick1 will then bring up a new panel over
the frmMain panel.
frmButtonClicked Class panel:
--------------------
This is a test 1
Cancel
---------------------
Click on Cancel will bring back the orginal frmMain Class panel.
I been looking at User Control but can not figure out how to to do
this.
Is there a simple sample code somewhere like this. I search but could
not find anything.
Hope this is clear. If not please let me know.
Any ideas would be helpful
Thanks Marty
-- modified at 10:00 Thursday 23rd February, 2006
|
|
|
|
|
I am interested in hearing how the .NET Dataset / Java serialization/deserialization is handled in the increasing number of .NET UI/Java mid-tier architectures.
I'm working on numerous applications for such an architecture and would prefer to retain the advantages of the DS at the client without impacting the "back-office" architecture. I'm very concerned regarding Datasets with multiple tables and relationships than a simple 1 table instance.
I'd especially like to know packages used, custom work performed, gotcha's, performance, bandwidth, etc.
if the many experts here don't have an answer, then it doesn't exist yet.
Nothing is impossible, we just don't know the way of it yet.
|
|
|
|
|
I don't think the dataset was really designed to do that. .NET 2.0 datasets are greatly improved over the .NET 1.1 ones, however. You might want to look into the Open Source DB4O which works with .NET or Java. Go to: http://www.db4o.com[^]
|
|
|
|
|
I've looked at db4o and other OO/ORB's - but they involve substantial work.
The DS is basically a relational architecture and Java is purely Object Oriented - inherently antagonistic paradigms (d**n - I said the P word!).- and predictably they don't mix well – like Chocolate Herring pie. The focus of my original question is to identify how others in my position have managed to get these things to work together in a nice, efficient manner.
So far that leaves me with three things to consider …
Replacing the DS completely means refactoring the code to use pure objects rather than the DS, adding custom binding code, adding all the object management logic (collections, relationships, database operations, matching the current behaviors exactly INCLUDING the errors, and tripling the project time with x thousand hours of regression tests, and possibly (probably) writing conversion test tools, enduser conversion tools, conversion backout tools, etc., etc., etc., etc., etc., etc., etc …… I wouldn’t want to do this for a simple standalone app let alone a multitier! it is far easier to just rewrite the whole thing.
Alternatively, supplementing the DS with a layer of pure object classes means more objects to design, code and maintain, DS to Object/Object to DS translation logic with increased potential for data logic/transcription errors, more complex change management processes (which would really endear me to the CM team), and god knows how much time to rewrite the developer documentation, utility classes, etc. I don’t know that this isn’t as messy as the other option.
The only reasonable option I've seen so far is to build specialized custom serializer/deserializer logic in both .NET and Java. While that brings its own issues with it, it is at least workable (subject to my continued research).
Last point ...
Eventually, we developers are going to have to force some integration standards on Microsoft, Sun, and IBM regarding the standardization between .NET and Java structures rather than trying to do it ourselves and being beaten bloody in the process.
Nothing is impossible, we just don't know the way of it yet.
|
|
|
|
|
If you have a database and you want to display relational data or do data processing via datasets, then datasets are a good choice. If your application is on the web, most of the time, you have to repopulate the datatsets to match the database each time you do a postback. With a Windows application, you don't have this problem but you run into the problem of keeping the data up-to-date. Datasets are great and have a lot of nice features but they do pose a resource hit when they grow beyond a certain size. As I said earlier, .NET 2.0 has improved performance and handles large datasets well. .NET 1.x datasets are slow.
I use a combination of datasets, business objects and XML in my projects. Since I can store and query XML on MS SQL and Oracle, I have been using that option more and more in my projects due to their hierarchical nature. Neverthess, using the XML DOM to process large documents is not recommended, IMHO. Business objects do require more work! Nevertheless, you have more control of the process to tweak for performance and to reduce resource overhead.
-- modified at 6:44 Wednesday 22nd February, 2006
|
|
|
|
|
|
Hi,
I have project written in .NET 1.1. It uses also some libraries of third parties (Firebird .Net provider and TAO - OpenGL library).
I want to transfer it to .NET 2.0.
I want to ask if there is 100% backwards binary compatibility in .NET 2.0. I mean, if I use for example TAO library compiled under .NET 1.1 in my .NET 2.0 app.. Will it correctly work under .NET 2.0?
And case, when I have only .NET 2.0 installed on system and 1.1. not.
Will be working everything compiled under 1.1 correctly. ??
For first I have tried to compile entire my project (except firebird provider and TAO) and it seems to work after a few tests.
I have tried to found something online on MSDN but without the results
Peter
|
|
|
|
|
Well in theory most of the code should work.
But in practise you will not know until you actually try;)
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
CWIZO wrote: Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
Your derived class is talking in the first person plural!
|
|
|
|
|
Don't you know the "All your base are belong to us!" joke?
http://en.wikipedia.org/wiki/All_your_base_are_belong_to_us
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Thanks! My Engrish is rusty.
|
|
|
|
|
hello all!
i have the folowing question:
i have the program that works with excel and word, and want to package these 3 versions into one setup project, that could define what version of office is installed on the user's PC and install the program the user needs.
coudl u help me?
thanx in advance.
Andrew.
|
|
|
|
|
Hi All,
I want to have an .net windows app that starts off with a openFileDialog
to choose the file to process. Works fine but I seem to be unable to dispose of the parent form properly.
How do I accomplish this?
|
|
|
|
|
You want to dispose of the parent form, or just hide the form that the open file dialog will lead to?
Because if you just hid the receiving dialog, you could just hide the dialog onload and show the openFileDialog. That'd work, right?
|
|
|
|
|
I want to dispose of it after the app ends. It hangs around and doesn't
delete itself.
Cindylou10
|
|
|
|
|
ok, im stuck in a very stupid situation.
I have a checkbox, i change it's value through user input AND through runtime code.
Problem:
When i change the value by code, it fires the checkedchanged event, which, in my opinion, is pretty damn stupid. I know it works for most people, and it may look normal to most people, but for me is very stupid. Example: u have a checkbox that, when pressed, if a certain condition is met, calls a function and changes another checkbox state (or even himself), WITHOUT triggering the changedevent. Y? Cause i want to separate user input from runtime code changes and this stupid control (and others,from what i've seen) mix it all up!
Do you know any property to avoid this or another event, to avoid this stupid behavior?
Thanks in Advance!
|
|
|
|
|
I checked in both .Net Framework 1.1 and 2.0, and the programmically changing the checkbox value does not fire the CheckedChanged event. The following example demonstrates this. If you toggle the checkbox, the textbox goes from String.Empty to 0 and, subsequently each time the checkbox gets toggled, the number in the textbox gets incremented. However, when you click on the button, the checkbox gets toggled but the textbox does not display the above described behavior.
Framework 2.0
Default.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></div>
<div style="margin-top: 10pt;">
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged" />
</div>
<div style="margin-top: 10pt;"><asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /></div>
</form>
</body>
</html>
Default.aspx.cs:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
int value = 0;
if (Int32.TryParse(TextBox1.Text, out value))
{
TextBox1.Text = (++value).ToString();
}
else
{
TextBox1.Text = value.ToString();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
CheckBox1.Checked = (CheckBox1.Checked) ? false : true;
}
}
|
|
|
|
|
Same for Windows Forms:
Windows Form Designer:
namespace CheckWin
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (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.textBox1 = new System.Windows.Forms.TextBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(12, 23);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 0;
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(143, 25);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(80, 17);
this.checkBox1.TabIndex = 1;
this.checkBox1.Text = "checkBox1";
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.Click += new System.EventHandler(this.checkBox1_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(22, 81);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 2;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 171);
this.Controls.Add(this.button1);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.textBox1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Button button1;
}
}
Windows Form Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CheckWin
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
checkBox1.Checked = (checkBox1.Checked) ? false : true;
}
private void checkBox1_Click(object sender, EventArgs e)
{
int value = 0;
if (Int32.TryParse(textBox1.Text, out value))
{
textBox1.Text = (++value).ToString();
}
else
{
textBox1.Text = value.ToString();
}
}
}
}
|
|
|
|
|
George's replies line up with what I've found, but if it's still messing up for you, you could always set a variable with the click function and with the code, and check that variable on check changed before you run anything else.
if(clicked == false)
//click toggled
else
//code toggled
|
|
|
|
|
Meh!
Sorry for the inconveniance. I was handling the CheckedChanged Event, not the click event. It's my 1st .Net project, usually i do c++ stuff, and as i am still a bit suspicious about .net, i thought it was another weird VB-like think they had.:->
Thank you all for the quick response.
|
|
|
|
|
What he is referring to is a boolean flag variable:
Pseudo Code:
class
{
protected:
void CheckedChanged()
{
if (flag)
{
//Process whatever
}
}
void RunTimeCode()
{
flag = false;
// Change Checkbox via code
flag = true;
}
private:
bool flag = true;
}
-- modified at 20:55 Friday 17th February, 2006
|
|
|
|
|