|
Erm, it depends on what behaviour you want from your graph. 'Normal' behavior would be to leave it as it is.
Ryan
Ryan.
|
|
|
|
|
Hi csharper's,
I am using automation to control MS Word with C#.
Does someone know if Word (Office) have a busy flag to test for to prevent a close command before work (printing) is done ?
Thank you
Frank
fracalifa
|
|
|
|
|
The problem is weird. I make a call to the method that does the binding. The method executes once, but it terminates after the databinding statement (not the close statements) then returns back to the Page_load method. This causes a problem because the connection is still open from the first time through. The html page with the dropdown list never appears.
If you can help great!
public class SA_ArptSelNav : System.Web.UI.Page<br />
{<br />
protected System.Web.UI.WebControls.ImageButton ZoomInButton1;<br />
protected System.Web.UI.WebControls.ImageButton ZoomOutButton1;<br />
protected System.Web.UI.WebControls.ImageButton ZoomPrevButton1;<br />
protected System.Web.UI.WebControls.ImageButton ZoomExtButton1;<br />
protected System.Web.UI.WebControls.ImageButton PanButton1;<br />
protected System.Web.UI.WebControls.ImageButton PrintButton1;<br />
protected System.Web.UI.WebControls.DropDownList DropDownList1;<br />
protected System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;<br />
protected System.Data.OleDb.OleDbCommand oleDbSelectCommand1;<br />
protected System.Data.OleDb.OleDbCommand oleDbInsertCommand1;<br />
protected System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;<br />
protected System.Data.OleDb.OleDbCommand oleDbDeleteCommand1;<br />
protected System.Data.OleDb.OleDbConnection oleDbConnection1;<br />
protected dbListOfAirports dbListOfAirports1;<br />
protected System.Web.UI.WebControls.ImageButton CopyButton1;<br />
<br />
private void Page_Load(object sender, System.EventArgs e)<br />
{<br />
if (!Page.IsPostBack) <br />
{<br />
BindListToDropDown();<br />
}<br />
}<br />
<br />
#region Web Form Designer generated code<br />
override protected void OnInit(EventArgs e)<br />
{<br />
InitializeComponent();<br />
base.OnInit(e);<br />
}<br />
<br />
private void InitializeComponent()<br />
{ <br />
this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter();<br />
this.oleDbDeleteCommand1 = new System.Data.OleDb.OleDbCommand();<br />
this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();<br />
this.oleDbInsertCommand1 = new System.Data.OleDb.OleDbCommand();<br />
this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand();<br />
this.oleDbUpdateCommand1 = new System.Data.OleDb.OleDbCommand();<br />
this.dbListOfAirports1 = new dbListOfAirports();<br />
((System.ComponentModel.ISupportInitialize)(this.dbListOfAirports1)).BeginInit();<br />
this.DropDownList1.DataBinding += new System.EventHandler(this.Page_Load);<br />
this.oleDbDataAdapter1.DeleteCommand = this.oleDbDeleteCommand1;<br />
this.oleDbDataAdapter1.InsertCommand = this.oleDbInsertCommand1;<br />
this.oleDbDataAdapter1.SelectCommand = this.oleDbSelectCommand1;<br />
this.oleDbDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {<br />
new System.Data.Common.DataTableMapping("Table", "tblAirport", new System.Data.Common.DataColumnMapping[] {<br />
new System.Data.Common.DataColumnMapping("AirportCode", "AirportCode"),<br />
new System.Data.Common.DataColumnMapping("AirportID", "AirportID"),<br />
new System.Data.Common.DataColumnMapping("AirportName", "AirportName"),<br />
new System.Data.Common.DataColumnMapping("City", "City"),<br />
new System.Data.Common.DataColumnMapping("Latitude", "Latitude"),<br />
new System.Data.Common.DataColumnMapping("Longitude", "Longitude"),<br />
new System.Data.Common.DataColumnMapping("State", "State")})});<br />
this.oleDbDataAdapter1.UpdateCommand = this.oleDbUpdateCommand1;<br />
this.oleDbDeleteCommand1.CommandText = "DELETE FROM tblAirport WHERE (AirportID = ?)";<br />
this.oleDbDeleteCommand1.Connection = this.oleDbConnection1;<br />
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_AirportID", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "AirportID", System.Data.DataRowVersion.Original, null));<br />
this.oleDbConnection1.ConnectionString = @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=0;Data Source=""D:\MGDevelopment\SIMDAC Viewer\DB\simdac_be.mdb"";Jet OLEDB:Engine Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1";<br />
this.oleDbInsertCommand1.CommandText = "INSERT INTO tblAirport(AirportCode, AirportName, City, Latitude, Longitude, State" +<br />
") VALUES (?, ?, ?, ?, ?, ?)";<br />
this.oleDbInsertCommand1.Connection = this.oleDbConnection1;<br />
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("AirportCode", System.Data.OleDb.OleDbType.VarWChar, 4, "AirportCode"));<br />
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("AirportName", System.Data.OleDb.OleDbType.VarWChar, 50, "AirportName"));<br />
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("City", System.Data.OleDb.OleDbType.VarWChar, 20, "City"));<br />
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Latitude", System.Data.OleDb.OleDbType.VarWChar, 50, "Latitude"));<br />
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Longitude", System.Data.OleDb.OleDbType.VarWChar, 50, "Longitude"));<br />
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("State", System.Data.OleDb.OleDbType.VarWChar, 2, "State"));<br />
this.oleDbSelectCommand1.CommandText = "SELECT AirportCode, AirportID, AirportName, City, Latitude, Longitude, State FROM" +<br />
" tblAirport";<br />
this.oleDbSelectCommand1.Connection = this.oleDbConnection1;<br />
this.oleDbUpdateCommand1.CommandText = "UPDATE tblAirport SET AirportCode = ?, AirportName = ?, City = ?, Latitude = ?, L" +<br />
"ongitude = ?, State = ? WHERE (AirportID = ?)";<br />
this.oleDbUpdateCommand1.Connection = this.oleDbConnection1;<br />
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("AirportCode", System.Data.OleDb.OleDbType.VarWChar, 4, "AirportCode"));<br />
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("AirportName", System.Data.OleDb.OleDbType.VarWChar, 50, "AirportName"));<br />
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("City", System.Data.OleDb.OleDbType.VarWChar, 20, "City"));<br />
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Latitude", System.Data.OleDb.OleDbType.VarWChar, 50, "Latitude"));<br />
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Longitude", System.Data.OleDb.OleDbType.VarWChar, 50, "Longitude"));<br />
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("State", System.Data.OleDb.OleDbType.VarWChar, 2, "State"));<br />
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_AirportID", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "AirportID", System.Data.DataRowVersion.Original, null));<br />
this.dbListOfAirports1.DataSetName = "dbListOfAirports";<br />
this.dbListOfAirports1.Locale = new System.Globalization.CultureInfo("en-US");<br />
((System.ComponentModel.ISupportInitialize)(this.dbListOfAirports1)).EndInit();<br />
<br />
}<br />
#endregion<br />
<br />
private void BindListToDropDown()<br />
{<br />
oleDbConnection1.Open();<br />
OleDbDataReader OleDbReader = this.oleDbSelectCommand1.ExecuteReader(CommandBehavior.CloseConnection);<br />
DropDownList1.SelectedIndex=0;<br />
DropDownList1.DataSource=OleDbReader;<br />
DropDownList1.DataBind();<br />
<br />
OleDbReader.Close();<br />
oleDbConnection1.Close();<br />
}<br />
}
|
|
|
|
|
Hi Everyone!
I make a Webform1.aspx which contains an web user control. In Microsoft IE it can viewed perfectly, but in Mozilla for example, some property can not run properly. For example, when i hide a some control on my web form when it run on Mozilla, all control is visible. I don't know reason why and how can fix it ?
Đào Ngọc Hào! Hi How Are You?
|
|
|
|
|
Hi,
I 've a function which takes 2 parameters, a dataset , path to XSD file. Based on contents of the xsd file i need to modify data in daatset to generate appropriate xml.How do I do this?
Thanks in advance
Priya
|
|
|
|
|
Hi Dpriya,
Guess the following code will give you an idea to solve the above problem.
The following code will take a XML file as the datasource(abc.xml) and will generate another xml file (abc234.xml) based on the schema (Test.xsd).
DataSet ds;
XmlDataDocument ddc = new XmlDataDocument();
ds = ddc.DataSet;
ds.ReadXmlSchema(@"Test.xsd");
ddc.Load(@"abc.xml");
ds.WriteXml(@"abc234.xml");
Hope this will help you.
Thanks and Regards
SGS
|
|
|
|
|
Hi
I extended a textbox control and created a property i.e
public enum myVarEnum {Apple,Mango,Peach};
protected myVarEnum myvar1;
public myVar MyProperty
{
get { return myvar1; }
set { myvar1 = value; }
}
Now when i use this extended control i am getting the property as a dropdown and i am able to select, the problem is the value i select doesnot persist..for example if i select "Mango" it goes back to the first one "Apple" after i build the solution. i guess its a small mistake plz help me overcome this...
Regards
Deepak.S
|
|
|
|
|
Apparently, the problem may be due to the fact that Visual C# does not allow you to create parameterized properties except for the indexer. The indexer is a specialized property that allows one to expose a group of values or objects on the name of the object. The name used in the indexer is required to be "this", i.e., the name of the object itself would be required to be used to access the property. An example would be like this:
private int[] myArray;
public int this[int index]
{
get
{
return myArray[index];
}
set
{
myArray[index] = value;
}
}
Try the above method and see whether it works.
|
|
|
|
|
Indexers allows to expose a group of values but how can i show those values in the designer so that the user can select one. I have to set other properties based on the selection made by the user. i guess indexers are availabe only in code on a object of that class.
Any other suggestions....
|
|
|
|
|
This works for objects:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public myVar MyProperty
{
get { return myvar1; }
set { myvar1 = value; }
}
don't know about enums though - maybe this will work
[DefaultValue(false)]
public myVar MyProperty
{
get { return myvar1; }
set { myvar1 = value; }
}
-spif2001
|
|
|
|
|
In fact, in the limited feature desired by you, I tried the method being used by you, and good news for you, it works!
The only change I made in your code (as shown above) is that I have used "public myVarEnum MyProperty" instead of "public myVar MyProperty" as used in your code (which appears to be a typing mistake), while defining the property.
In the sample small project prepared by me, the values "Mango" and "Peach" also persist if set at design time from the Property window from the dropdown. If you wish, I can separately send you the sample project files. Otherwise, I am including the source code of the MyButton.cs file (the inherited control) and the Form1.cs hereinbelow for your information:
using System;
namespace TestControl2
{
public class MyTextBox : System.Windows.Forms.TextBox
{
public enum myVarEnum {Apple,Mango,Peach};
protected myVarEnum myvar1;
public myVarEnum MyProperty
{
get { return myvar1; }
set { myvar1 = value; }
}
public MyTextBox()
{
}
}
}
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace TestControl2
{
public class Form1 : System.Windows.Forms.Form
{
private TestControl2.MyTextBox myTextBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.myTextBox1 = new TestControl2.MyTextBox();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
this.myTextBox1.Location = new System.Drawing.Point(184, 48);
this.myTextBox1.MyProperty = TestControl2.MyTextBox.myVarEnum.Peach;
this.myTextBox1.Name = "myTextBox1";
this.myTextBox1.TabIndex = 0;
this.myTextBox1.Text = "myTextBox1";
this.button1.Location = new System.Drawing.Point(88, 104);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
this.label1.Location = new System.Drawing.Point(88, 176);
this.label1.Name = "label1";
this.label1.TabIndex = 2;
this.label1.Text = "label1";
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.Controls.Add(this.myTextBox1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
label1.Text = myTextBox1.MyProperty.ToString();
}
}
}
The last method button1_Click, puts the value "Mango" etc. in the label1 on Form1. Hope it solves your problem.
|
|
|
|
|
I want to add a delay at the end of my while loop, so that it executes once every 10 minutes but am unsure how that works in C#.
I've tried Thread.Sleep, but it doesnt delay the loop.
Any suggestions?
|
|
|
|
|
Use a timer, and when 10 minutes have elapsed, start your processing.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
how the timer can be used????????????????????????
It has lot of classes>>>>and members
please tell something in detail
|
|
|
|
|
It's actually very easy. There are two kinds of timers in the .NET Framework:
- Windows Forms timers (
System.Windows.Forms.Timer class), which you drag in the desinger to your form, set some properties, and write the code for the Tick event handler, and that's it. For your situation, the problem is that if the process is long, it will block your UI thread and your main form will not be responsible. - Thread timer (
System.Threading.Timer ). I have never used this one, but from the docs[^] it seems you set a timer, without requiring a form, that will run on another thread. So, your form keeps working normally while another thread does your processing on the background.
I believe the second one will suit your purpose better. But, as I have never used a System.Threading.Timer , I can't be of more help, since all I know is the same as you, what is included in the documentation.
If someone knows better, feel free to correct me please!
Good luck!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Thread.Sleep should work. What did you pass as the parameter? For 10 minutes, it should be 10 * 60 * 1000. But remember that Thread.Sleep would be less efficient than a signaling mechanism as Thread.Sleep would cause the Thread to use up CPU time...
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
|
Thread.Sleep() causes "busy wait", where the thread uses up its quantum of CPU time doing nothing. Waiting for a signal (or in general, any OS synchronization mechanism) causes the thread to be context switched for another immediately. This obviously results in performance benefits as other threads get a chance to run in the time that a "sleeping" thread would have spent doing nothing.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I have a collection of items. Each item has some events. I am exposing the collection through a property which shows up on the propertygrid of the form. I can edit the collection and all the persistance to the code is allreay taken care of.
One problem remain which I can't solve. I can't edit the events of each item like you can normaly edit with the form's events or the control's events. The collection editor don't show the event tab.
The main goal is to edit this collection like you edit a menu and it's items. You can edit the menu items events. My class is not for visual porpose and is been used on components, not just forms, so the solution of using a collection-Based Controls with Rich Design-Time Support http://www.codeproject.com/csharp/collcontrolsrichdes.asp
is not valid for this case.
Thanks in advance. Any help will be appreciate.
|
|
|
|
|
Hello all,
I Work with active X control i added it with " Add Reference" and i used the functions that it exposed to me in my code did it need any installtion code to setup or just i add a refrence to it in my code only.
Regards,
Hay
|
|
|
|
|
No need for any separate installation code.
The basic procedure for using ActiveX control in your Visual C# code is as under:
1. Add a reference to the type library containing the ActiveX control.
2. If you want to take advantage of the designer, add the ActiveX control to the Toolbox by customizing the Toolbox.
3. Now, drag an instance of the ActiveX control from the Toolbox to your designer to add it to your project at design time. This will add the necessary code to instantiate the control in your project. Alternatively, you can declare and then instantiate the ActiveX control in code and add it dynamically to your application at run time.
|
|
|
|
|
I am trying to crete a method that will convert an improper fraction to a mixed number...
I am not sure how about how to acomplish this. I know I can get the remainder with the modulus operator (%), but I am not sure how to get the quotent.
Any insight would be appreciated.
thanks
|
|
|
|
|
One method to get the quotient (or the whole number portion of the improper fraction) is to use a function such as under:
public int GetWholeNumber(int numerator, int denominator)
{
int wholeNumber = 0;
int tempNumber = Numerator;
while(tempNumber >= Denominator)
{
tempNumber -= tempNumber ;
wholeNumber ++ ;
}
return wholeNumber;
}
Or, alternatively, you can also try the following method:
int Numerator = 57 ;
int Denominator = 9;
int wholeNumber = (int) (Numerator / Denominator);
|
|
|
|
|
Hi!
I'm building a grid control which contains a grid of cell controls. Each cell is supposed to contain another control. Everything works fine except the design-time behaviour which I have two problems with. The first is to draw adornments on the cells, which are another control type contained within the grid control (sort of the same as a panel control)..
[Designer(typeof(LayoutGridDesigner))]
class LayoutGrid : Control
{
ArrayList<gridcell> gridCells;
...blabla...
}
[Designer(typeof(GridCellDesigner))]
class GridCell : Control
{
}
I've tried to make both the GridCellDesigner and the LayoutGridDesigner to paint a dotted line around (inside the border of) the GridCell. The gridcell won't paint anything - I expect this to be because child control don't seem to paint adornments. When trying to paint the adornments with the GridLayoutDesigner the gridcell keeps on repainting...
The second thing I want to do is to make the gridcells able to contain other controls. This works by making GridCellDesigner inherit from ParentControlDesigner instead of ControlDesigner, but as with the adornments it doesn't work when the gridcell is a child control..
Any suggestions?
|
|
|
|
|
HI
Need help, Does anyone know how , which code i should use to open an authentication window from the code? when using webclient features, Im talking about the same window that opens in the Gmail Notifier on the startup , the one that you get when trying to navigate to a protected 401 page.
i tried using the httputility class , but no luck .
please HELP!!!
Thanks a lot
MOshe.
thanks , moshe bar-oz
|
|
|
|
|