|
What is Schema.ini?(Know little,want more)...
I want to export a database content to textfile...For implementing this, how schema.ini helps in defining the text qualifiers for the different type of fields....(ie. in case of Strings "",in case of Numbers no qualifiers...)
Kindly help me...
-- modified at 0:00 Friday 16th December, 2005
|
|
|
|
|
Ok, this is a simple question, but I've tried and looked and just can't seem to come up with an answer...
In my VB6 app, I can create an array of controls simply by copy and pasting for the default "do you want to make this object an array" prompt...
In C#, I get no prompt, and no menu option (that I can see.. maybe I'm blind) to make an array.
I simply want to be able to create an array of x number of checkboxes (or any control, for that matter) in a panel so I can cycle through them with an iteration statement... What am I missing? If this involves more code than using iteration would save, just tell me and I'll move on.
Thanks in advance.
|
|
|
|
|
Ok...
I found the C# tutorial on how to create a group of controls from a string array... Is this the only way to create and use an array of controls? I'd really much prefer to have them available at design time, not to mention having to plot their location every time I want to create another array of controls. I find it hard to believe that .NET would make something that seems so fundamental such a pain in the arse...
|
|
|
|
|
"control arrays" per se are not supported by the VS.NET designer. However, it's easy to manually build an array containing controls that are on your form:
CheckBox[] checkBoxes=new CheckBox[]{myCheckBox1, myCheckBox2, ...};
If you need dynamically created control arrays that will be resized at runtime to an arbitrary size, you will need to create the checkboxes manually and add them to a list:
List<CheckBox> checkBoxes = new List<CheckBox>();
for(int i=0;i<myCount;i++)
{
CheckBox checkBox = new CheckBox();
checkBox.Location = new Point(10,10+(20*i));
checkBox.Size = new Size(50, 20);
checkBox.TabIndex=i;
checkBox.Text="CheckBox "+i.ToString();
panel.Controls.Add(checkBox);
checkBoxes.Add(checkBox);
}
|
|
|
|
|
I need to write a program which can draw rectangle by mouse. User can draw a rectangle by click left mouse button and drag mouse, when user release left mouse button, rectangle will be drawn.
I can draw rectangle, but now I want to check when I move mouse, program can show me the mouse is inside a rectangle or not.
I use an RectangleArray which inherits from CollectionBase to store all drawn rectangle. In mouse move method, I loop through this array and use Contains method of Rectangle class to check the mouse inside or not.
But I don't understand while I only can check the position of mouse if it is inside the first rectangle I drawn (label4 only change value when I move the mouse inside the first rectangle). If I show a message box, label4 can change its value when I move the mouse inside any rectangle.
private void picImage_MouseMove(object sender, MouseEventArgs e)
{
Point mousePoint = new Point(e.X, e.Y);
foreach (Rectangle rect in rects)
{
if (rect.Contains(mousePoint))
{
label4.Text = "In rect";
break;
}
else
{
label4.Text = "Not in rect";
}
}
}
Can anybody help me? Thanks a lot!
I'm ...
a fan of Manchester United
a fan of Ozzy Osbourne
a King of Nothing
|
|
|
|
|
Windows - including controls (which are client windows) - are only sent messages such as mouse move messages when the mouse is over them or the mouse is captured (I'll get to that in a second). Forms that parent controls such as your label can receive mouse events for their children, which actually happens anyway since the parent control will dispatch messages to their children. This is why the label only knows about mouse movement within its client region.
In order to be notified when the mouse moves outside of the control you need to capture the mouse. See http://msdn2.microsoft.com/en-us/library/ms171545(en-US,VS.80).aspx[^] for general information, making note of the following:Only the foreground window can capture the mouse. When a background window attempts to capture the mouse, the window receives messages only for mouse events that occur when the mouse pointer is within the visible portion of the window. Also, even if the foreground window has captured the mouse, the user can still click another window, bringing it to the foreground. When the mouse is captured, shortcut keys do not work. Try the following sample:
public class Form1 : Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox checkBox1;
public Form1()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label1.Location = new System.Drawing.Point(33, 98);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(221, 33);
this.label1.TabIndex = 0;
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.label1.MouseLeave += new System.EventHandler(this.label1_MouseLeave);
this.label1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.label1_MouseMove);
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(36, 135);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(97, 17);
this.checkBox1.TabIndex = 1;
this.checkBox1.Text = "Capture mouse";
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
private void label1_MouseMove(object sender, MouseEventArgs e)
{
label1.Text = e.Location.ToString();
}
private void label1_MouseLeave(object sender, EventArgs e)
{
if (!label1.Capture)
{
label1.Text = string.Empty;
}
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
label1.Capture = checkBox1.Checked;
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
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]
|
|
|
|
|
Maybe my description has some confusion for you. Here is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace RFCart
{
public partial class Main : Form
{
private int drawMode;
private bool mouseIsInShelf;
private Shelf currentShelf;
private ShelfArray shelfs = new ShelfArray();
private void Main_Load(object sender, EventArgs e)
{
drawMode = Constant.SHELF_MODE;
}
private void picImage_MouseDown(object sender, MouseEventArgs e)
{
switch (e.Button)
{
case MouseButtons.Left:
Point mousePoint = new Point(e.X, e.Y);
if (drawMode == Constant.SHELF_MODE)
{
currentShelf = new Shelf();
currentShelf.StartPoint = mousePoint;
}
break;
}
}
private void picImage_MouseUp(object sender, MouseEventArgs e)
{
switch (e.Button)
{
case MouseButtons.Left:
Point mousePoint = new Point(e.X, e.Y);
if (drawMode == Constant.SHELF_MODE)
{
currentShelf.EndPoint = mousePoint;
shelfs.Add(currentShelf);
picImage.Invalidate();
}
break;
}
}
private void picImage_MouseMove(object sender, MouseEventArgs e)
{
Point mousePoint = new Point(e.X, e.Y);
foreach (Shelf shelf in shelfs)
{
if (shelf.Contains(mousePoint))
{
mouseIsInShelf = true;
break;
}
else
{
mouseIsInShelf = false;
}
}
}
private void picImage_Paint(object sender, PaintEventArgs e)
{
foreach (Shelf shelf in shelfs)
{
shelf.Draw(e.Graphics, Color.Red);
}
}
}
}
Shelf.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace RFCart
{
class Shelf
{
private Rectangle boundRectangle;
private Point startPoint;
private Point endPoint;
public Point StartPoint
{
get
{
return startPoint;
}
set
{
startPoint = value;
}
}
public Point EndPoint
{
get
{
return endPoint;
}
set
{
endPoint = value;
}
}
public Rectangle BoundRectangle
{
get
{
return boundRectangle;
}
set
{
boundRectangle = value;
}
}
public void Draw(Graphics graphics, Color color)
{
int width = Math.Abs(EndPoint.X - StartPoint.X);
int height = Math.Abs(EndPoint.Y - StartPoint.Y);
int x = Math.Min(StartPoint.X, EndPoint.X);
int y = Math.Min(StartPoint.Y, EndPoint.Y);
boundRectangle = new Rectangle(x, y, width, height);
GraphicsPath path = new GraphicsPath();
Pen pen = new Pen(color, Constant.PEN_WIDTH);
path.AddRectangle(boundRectangle);
graphics.DrawPath(pen, path);
pen.Dispose();
}
public bool Contains(Point point)
{
return boundRectangle.Contains(point);
}
}
}
ShelfArray.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace RFCart
{
class ShelfArray : CollectionBase
{
public void Add(Shelf shelf)
{
List.Add(shelf);
}
public Shelf this[int index]
{
get
{
return (Shelf)List[index];
}
set
{
List[index] = value;
}
}
}
}
After I draw 2 rectangles, when I move mouse into the first rectangle, mouseIsInShelf will change to true. But when I move the mouse into the second rectangle, mouseIsInShelf still false. I think it should be true.
Help me more! Thanks a lot!
I'm ...
a fan of Manchester United
a fan of Ozzy Osbourne
a King of Nothing
|
|
|
|
|
hello, i have a string that i need data to be extracted from, but i do not know much about regex. can someone please show me how to do this? thanks.
i start with this string:
[09.17.2005 15:22:58] VIOLATION (GAME INTEGRITY) #20006: ^r||^cS^rF^cO^r||^cSin^rner (slot #6) Violation (GAME INTEGRITY) #20006 [dfcbd87f99e62f4915732e0b26f804e9(VALID:78) 87.211.1.131:27960] i need to extract the following information, and save it in a new string string1, string2, string3, etc.:
09.17.2005 15:22:58
always starts as 2nd character and ends as 20th character
GAME INTEGRITY
always starts as 33rd character, ends at first ) after it starts
20006
always starts 3 characters after the (GAME INTEGRITY), and is 5 digits long
^r||^cS^rF^cO^r||^cSin^rner
name, always starts 2 characters after the 20006, and ends at the (slot #
dfcbd87f99e62f4915732e0b26f804e9
32-digit long GUID, starts at 2nd character after the 2nd (last) #2006 (or 5 digit ID)
87.211.1.131
the ip, starts 1 character after (VALID:78) where 78 is a number between 1 and 9999
thanks for the help, hopefully there is a way of doing this.
sam kline
<a href="http://dying.about.com/gi/pages/poll.htm?poll_id=2068629450">YES</a>
|
|
|
|
|
\[(.{19})\]([^)]+\)).{2}(.{5}):\s*([^\(]*)\(slot #[\d]+\) [^\d]*\d{5}^\w*(.{32})[^\)]*\)\w*([\d\.]*)
That should work, but to be honest, Expresso threw a fit and stopped giving me any more than 4 match groups ( but kept on working while I worked through the regex ). The matches should all be grouped, so you need just iterate through the groups to get them all.
If you google and download Expresso, you'll find it's very useful for working on RegEx.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi, could you please give me an example of how to open an executable file on remote machine using WMI? I have worked on it for a whole day without any result. Thank you in advance.
Erick
|
|
|
|
|
There are problems with what you're doing. The first of which, a process launched on a remote computer cannot be interactive. This means that you won't see it appear on the desktop, but it will show up in the remote machine's Task Manager.
You can read more about it here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi I wat to pass objects than have ToString(strig Format) and Parse(string value) in method's parameter.
So I want to know what interface use for pass double, int, datetime, etc. that have these methods
public void AddFormat( iteface? param,string format)
{
this.txtValue.Text = param.ToString(format);
}
public object GetValue()
{
return myObject.Parse(this.txtValue.Text);
}
Thank you
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
Maybe you must pass param as object ? Then you can pass in everything you want (enum, int, float, double, etc.).
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Yes but I want only objects that have ToString(string format) and Parse(string value), like int,double, datetime and others.
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
I guess you'll have to use reflection for that.
public object GetValue()
{
MethodInfo method = myObject.GetType().GetMethod("Parse");
ParameterInfo[] parameterList = method.GetParameters();
if (parameterList.Count == 1 && parameter[0].ParameterType == typeof(string))
{
method.Invoke(...);
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
wow is a good aproach.
I really like when peopple answer question i differents ways!
I theink a use it.
Thank you very much!!!
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
Frankly, I have just finish a new project, and I want to create A setup file for it, but the problem is how to attach the database files ...
I want to know if it was possible to make the application attach a dataBase file automatically or not, and if it was possible, HOW ??
By the way, i use SQL server 2000
Thnkas in advance
Bagie
|
|
|
|
|
If you use the Visual Studio Setup Project, then to do what you want without extra work you must create an executable that gets installed on the target machine and set it as a Custom Action in the Commit install event. Use that executable to call SQL Server 2000 to attach the database files.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
thanks for your care,
i'm sorry to say that but can you illustrate it to me in steps
as I'm still confused
thanks
Bagie
|
|
|
|
|
- Create a backup of the database.
- Add it to your setup program.
- Create an executable that will connect to a datasource and run the following SQL statement
RESTORE DATABASE TestDB
FROM DISK = '[source_file]'
WITH MOVE '[db_name]' TO '[data_file_name]',
MOVE '[db_name]_log' TO '[log_file_name]'
- Build the execuatble and add it to your Setup project.
- Add the executable to the list of custom actions in the commit section.
For more information, please see the Transact-SQL Reference.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
THANK YOU VERY MUCH
That helps me a lot
I appreciate your care ..
Bagie
|
|
|
|
|
No problem. Happy coding!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
i have some problems with Crystal Reports ...
i can't provide it with data correctly
so, can anybody send me an example of using it [ IN STEPS ]
Thanks in advance
Bagie
|
|
|
|
|
Just do a bit search from this site....
<< >>
|
|
|
|
|
thx for your replay
I tried, and I found one ...
but I need more illustration
and I'm still a beginner
so, I wish I found help
thanks
Bagie
|
|
|
|
|