|
After looking at this method for about a day, I've realized it will not do what I need. Using the process object returns processes - and I need applications, that are not listed in the process list. Not just applications, but the window handles to all the windows that are urrently open on the desktop; many applications have more than one window open at a time, I need them as well.
|
|
|
|
|
i've added to my application a setup solution.
I've got all the standard form that visual studio made automatically.
If i want handle the main function of the form n°1 or handle the click of the button... how can i do?
|
|
|
|
|
Hello everyone,
I am currently working on this project, and I need to read in a dbf file and parse it as well. But I cannot do it without some driver or something like that. I was wondering what driver it was to read in the file because I have been searching for it on the internet but I cannot find much information on the subject.
Thanks,
TheMajorRager
|
|
|
|
|
If you need to read and parse the file, then use a FileStream . If you want to open and use it as a database file for ADO.NET, use an instance of OleDbConnection with the appropriate connection string to point to the file. The System.Data.OleDb namespace classes allow you to use any OLE DB driver, and there is for DBase files.
To get the correct connection string, you can create a new connection in the Server Explorer in Visual Studio, select the DBase OLE DB provider, and browse to the file. I recommend in shipping code, however, that you make at least the file path a configuration variable in the app.config file since a user may place or move the dbase file elsewhere on their drive or on the network.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thank you for replying! My problem is that when I open the file however, I want my program to use the comma as a delimiter, is there a way to convert a dbf to a csv file, because I want to parse the file, but I cannot parse it the way I can with a csv or exp file.
|
|
|
|
|
Sure you could parse it - it's just a file. How you parse it (i.e., understanding the file structure) depends on the dbase format with which I'm not familiar. There's probably a lot of resources on the web about this, however.
The big question is why you want to parse it? If you want to run SQL statements on it, fill DataSet s, etc. - all the stuff you'd normally do with any other database - use the OleDbConnection with the correct connection string for the dBase OLE DB provider and to specify the path to the file and any other properties that dBase supports.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Nevermind, you were right, I need to use the OleDbConnection. I am trying to use that but when I try to open the .dbf file I get an error message, saying it is not a valid database.
-- modified at 19:33 Wednesday 5th October, 2005
|
|
|
|
|
Nevermind, I figured it out, thanks a lot!
Sincerely,
TheMajorRager
|
|
|
|
|
Hi,
I have a groupbox with number of checkboxes in a form.
I want only one check box being checked at a time (just like radio buttons)
How do I do that. Thanks.
|
|
|
|
|
Why not use radio buttons?
To make checkboxes exclusive is not very user friendly, as that is not the normal behaviour of checkboxes. Radio buttons on the other hand always work that way, so the user would know what to expect.
---
b { font-weight: normal; }
|
|
|
|
|
You should use RadioButton s, then, within the same container control. Not only do they already provide the functionality you want, but it gives the user a consistent experience which is very important for applications. Great care goes into creating Windows and Windows applications to make sure users have a consistent experience. ISVs should follow these guidelines as well.
If you have a legitemate reason for using CheckBox es, you'll have to clear them yourself. I recommend writing a separate class that uses a list with you can add CheckBox es to and then have methods to clear all except the one that was checked. You could also simply enumerate all controls in your container using the Control.Controls property and - if the current enumerated control is a CheckBox and it's not the one that was clicked, clear the check mark. It also allows you to logically group differnet check boxes even if they're in the same container or different containers.
The former - using a separate class - is more flexible and scalable. A simple example follows:
using System;
using System.Collections;
using System.Drawing;
using System.Windows.Forms;
class CheckBoxManager
{
ArrayList cbs;
bool changing = false;
public CheckBoxManager()
{
cbs = new ArrayList();
}
public void Add(CheckBox cb)
{
if (cb == null) throw new ArgumentNullException("cb");
cbs.Add(cb);
cb.CheckedChanged += new EventHandler(OnCheckChanged);
}
public void AddRange(IEnumerable cbs)
{
if (cbs == null) throw new ArgumentNullException("cbs");
foreach (object obj in cbs)
{
CheckBox cb = obj as CheckBox;
if (cb != null) Add(cb);
}
}
void OnCheckChanged(object sender, EventArgs e)
{
if (changing) return;
else changing = true;
foreach (CheckBox cb in cbs)
{
if (sender != cb) cb.Checked = false;
}
changing = false;
}
}
class Test : Form
{
static void Main()
{
Application.Run(new Test());
}
Test()
{
CheckBoxManager group0 = new CheckBoxManager();
CheckBoxManager group1 = new CheckBoxManager();
int top = 8;
for (int i = 0; i < 10; i++)
{
bool isgroup0 = i % 2 == 0;
CheckBox cb = new CheckBox();
if (isgroup0) group0.Add(cb);
else group1.Add(cb);
Controls.Add(cb);
cb.Text = string.Format("CheckBox{0} (Group {1})", i, i % 2);
cb.Top = top;
cb.Left = 8;
cb.Width = 200;
top = cb.Bottom + 8;
}
Height = SystemInformation.CaptionHeight + top;
Text = "CheckBoxManager Example";
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
I want to sublty allert my user to missing data with a visual prompt slighlty more stark than the basic "(null)" given by a data grid. Ive changed the message with a custom colomn style BUT i want to make that message bold and a different colour.
Is there an easy way to achive this using settings?
Thanks.
-- modified at 12:59 Wednesday 5th October, 2005
|
|
|
|
|
For a DataGridTextBoxColumn you can access the embedded TextBox using the DataGridTextBoxColumn.TextBox property. If you want more control - such as encapsulating the data logic for displaying text differently based on the current value - implement your own DataGridColumnStyle and draw the text and background as you want in your DataGridColumnStyle.Paint override.
There is at least one example of this here on CodeProject. Please search the articles using "DataGridColumnStyle" and you should find it.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Can somebody tell me how I add a chart to my user form that will display the 2 values in the 2 textboxes..Is there a way of creating the chart from scratch using a co-ordinate and draw functions?? im confused..Thanks James..
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication7
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textBox3;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(48, 56);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(48, 32);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(48, 112);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(48, 32);
this.button2.TabIndex = 1;
this.button2.Text = "button2";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(160, 56);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(88, 20);
this.textBox1.TabIndex = 2;
this.textBox1.Text = "textBox1";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(160, 112);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(88, 20);
this.textBox2.TabIndex = 3;
this.textBox2.Text = "textBox2";
//
// groupBox1
//
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.textBox3});
this.groupBox1.Location = new System.Drawing.Point(24, 16);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(256, 224);
this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "groupBox1";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(144, 144);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(64, 20);
this.textBox3.TabIndex = 0;
this.textBox3.Text = "textBox3";
this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.textBox2,
this.textBox1,
this.button2,
this.button1,
this.groupBox1});
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
textBox1.Text = Convert.ToString(2*2);
}
private void button2_Click(object sender, System.EventArgs e)
{
int val = 10;
int show = 0;
for (int i = 0; i < 1234; i++)
for (int j = 0; j <1200; j++)
{
val = val + 10;
show = j;
// or val += 10;
}
textBox2.Text = Convert.ToString(2*2*3^22 + val);
textBox3.Text = Convert.ToString(+ show);
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
private void textBox3_TextChanged(object sender, System.EventArgs e)
{
}
}
}
|
|
|
|
|
hi there,
james377 wrote:
how I add a chart to my user form
which chart lib r u using?
james377 wrote:
Is there a way of creating the chart from scratch
Sure, u can create ur own chart. Using System.Drawing namespace
And I'm pretty sure there are a lot of article about this on CP site. just search it...
<< >>
|
|
|
|
|
do you have any code for this m8?
|
|
|
|
|
wat is the m8?
I never heard about this before
<< >>
|
|
|
|
|
hi,
I have a question. How can I insert/paste text from a clipboard into the current cursor position of a rich text box.
Nana
|
|
|
|
|
Quit simply you can call RichTextBox.Paste . You can either do this using the first available and acceptable format by calling the method with no parameters, or pass the data format you want. See the documentation[^] for the Paste method for more information.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have an asynchronis socket class written by my manager that uses Socket.BeginSend(...) to send messages over the socket. He uses this overload of the function:
public IAsyncResult BeginSend(
byte[] buffer,
int offset,
int size,
SocketFlags socketFlags,
AsyncCallback callback,
object state
);
where the delegate callBack should call another function in the code, HandleSend, which does some important things after a packet is sent. The program goes all the way through the BeginSend function, but randomly, the callBack delegate seems to stop calling HandleSend. I am not sure if this is the problem, but it really looks that way. I don't think I understand how the function BeginSend works in conjunction with the AsyncCallBack delegate. Could there be a thread safe problem with this logic?
Please help!
Thanks,
Lilli
|
|
|
|
|
Hi every one. Can any one please help me with ideas on how I can insert/paste text from a clipboard into the current cursor position in a textbox.
Nana
|
|
|
|
|
Hi Nana!
Use RichTextBox.Paste() .
Regards,
mav
|
|
|
|
|
Its working. Thank you Thank you.;)
Nana
|
|
|
|
|
Here is my problem. I'm trying to draw a vector on a graph on a WinForm.
I want an arrow (triangle) on the end of the line. I have two files.
My pens are "cycled" on each paint event (0, 1, 2.. repeat). Everything works ok. I just can't seem to figure out how to draw an arrow....
Complex.cs
///////////////////////////////////////
private double x
private double y
//Constructor
public Complex()
{
x = 0;
y = 0;
}
public Complex( double _x, _y)
{
x - _x;
y = _y;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////Form1.cs
public Pen[] activePen = new Pen[] { new Pen( Color.Blue, 2 ), new Pen( Color.Green, 2 ), new Pen(Color.Red, 2) };
private int _penIndex = -1;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
private Pen GetNextPen()
{
_penIndex = (_penIndex + 1) % 3;
return activePen[_penIndex];
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
g.DrawLine(GetNextPen(), 250, 250, x, y );
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
Look at the Pen.EndCap property. There is an enumeration that will allow you to put arrows on your line.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|