|
Richard MacCutchan wrote: Yes I tried it, using C#
Never mind
Bastard Programmer from Hell
|
|
|
|
|
Eddy Vluggen wrote: Never mind
I don't mind, it's you that kept banging on about it, like a
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
when you do
using some1.some2.some3;
then the C# compiler will add "some1.some2.some3" to the list of known prefixes, which it uses to locate a type.
Therefore,
using System.Windows.Forms;
...
Form f=new Form();
Forms.Form f2=f;
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
i think you should use "Add reference",
right click on form->Add reference,
there you will get all the namespace which are available.
|
|
|
|
|
I've added the MS Excel 14.0 Object Library reference (COM Tab), Richard the link that you have recommended is one that I have already followed but I was still getting the error.
|
|
|
|
|
pmcm wrote: Richard the link that you have recommended is one that I have already followed but I was still getting the error.
Can you show your code and the exact text of the error message?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I fixed this issue by doing:
using Microsoft.Office.Interop;
using Excel = Microsoft.Office.Interop.Excel;
using Word = Microsoft.Office.Interop.Word;
|
|
|
|
|
That's what I suggested yesterday.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi.
I write a code for create a polygan in c#
Now i want moving it on the form but i cant.
I want know how i can move a polygan on the form.
My code for create a polygan is:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace graphic_aghaye_bagheri
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public class polygan
{
public int x1;
public int y1;
public int x2;
public int y2;
public int x3;
public int y3;
public int x4;
public int y4;
public int x5;
public int y5;
public polygan(int x11, int y11,int x22,int y22,int x33,int y33,int x44,int y44,int x55,int y55)
{
x1 = x11;
y1 = y11;
x2 = x22;
y2 = y22;
x3 = x33;
y3 = y33;
x4 = x44;
y4 = y44;
x5 = x55;
y5 = y55;
}
}
private Graphics x;
private Pen myPen = new Pen(Color.Tomato,5);
int r = 30;
int currentvert = 5;
private polygan polygan1 = new polygan(200,200,300,200,350,250,300,300,200,300);
private void button1_Click(object sender, EventArgs e)
{
Point[] myPoints = { new Point(200, 200), new Point(300, 200), new Point(350, 250), new Point(300, 300), new Point(200, 300) };
Graphics myG = this.CreateGraphics();
Pen myPen =new Pen(Color.Tomato, 4f);
x.DrawPolygon(myPen, myPoints);
timer1.Start();
}
private void Form1_Load(object sender, EventArgs e)
{
x = this.CreateGraphics();
}
private void timer1_Tick(object sender, EventArgs e)
{
polygan1.x1 = polygan1.x1 + r;
polygan1.y1 = polygan1.y1 + r;
polygan1.x2 = polygan1.x2 + r;
polygan1.y2 = polygan1.y2 + r;
polygan1.x3 = polygan1.x3 + r;
polygan1.y3 = polygan1.y3 + r;
polygan1.x4 = polygan1.x4 + r;
polygan1.y4 = polygan1.y4 + r;
polygan1.x5 = polygan1.x5 + r;
polygan1.y5 = polygan1.y5 + r;
}
}
}
Tanks a lot.
|
|
|
|
|
Just updating the points in your timer won't actually redraw your polygon. You actually need to trigger a paint message to redraw the polygon (the crudest method being to refresh the form). You really need to move the paint functionality into the form Paint event handler so you can just get the Graphics object there rather than creating your own (which you haven't disposed).
The other big problem is that you create your polygon and then you don't use it to draw with. I would fix that if I were you.
|
|
|
|
|
You may want to read this article[^], it explains the principles you need.
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
Copy this code after creating a new form (without copying form references).
You need to copy namespaces as well.
Run it and see what issues you get - you can post them here and someone may help you.
|
|
|
|
|
Abhinav S wrote: Copy this code Are you referring to the code in the link posted by Luc ? ... or ... missing link ?
thanks, Bill
"The first principle is that you must not fool yourself, and you are the easiest person to fool." Richard Feynman
|
|
|
|
|
I'm referring to the code that the OP has posted.
|
|
|
|
|
This is quite close to a self-submission to the Hall of Shame. You don't appear to have understood how to do custom painting at all (hint: check out the Paint event), you never read the values out of your 'polygan' (sic) class, you allocate and never dispose of extra graphic objects, you use meaningless names ...
You really need to go away and understand the WinForms graphics model properly. I could give an entire solution but it wouldn't help you actually learn the principles you are so clearly lacking.
|
|
|
|
|
Could u tell me how to get name and count of tables in a MS Access database?
I tried by MSysObjects but i have an error.
Error says that to use administrator account.
But i have used just an administrator account one. Could u tell me any other ways for that matter.
|
|
|
|
|
PiebaldConsultant gave you and Answer yesterday[^]. If you want more help you will need to be more specific:
1) Did you try his suggestion it should work- if not what went wrong
2) How are you accessing MSysObjects (supply code)?
Point 2 is most important as there are several scenarios:
A: You are accessing the table directly in which case you need to be an admin on the database
B: You are accessing via an application
If this is using windows authentication to the database: The account the app is running under needs to be an admin on the database. For a winforms app, it would be running under your account. Web apps are more complicated and you'll need to work out which account is being used.
If this is using an "SQL account" (i.e. you have supplied a username and password)to the database: The account specified needs to be an admin on the database
|
|
|
|
|
There is "SYS" in MSysObjects, no wonder you need a special account when going that route.
Stick with OleDbConnection.GetSchema() as Piebald told you.
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
I strongly recommend avoiding database-specific techniques. ADO.net includes interfaces and base classes that make database-agnostic access very easy to accomplish.
|
|
|
|
|
phowarso wrote: Error says that to use administrator account. But i have used just an
administrator account one.
That's not refering to an admin account on the machine. That's refering to the designated administrator account in the database. The two are not the same thing.
Seriously, follow the advice given yesterday. You're trying to do it the hard way.
|
|
|
|
|
I have a mail server used exchange 2003, but most of spam message in queues, i want to get an application used to delete the spam mail from queues, how to do it?
ms Microsoft exchange queue spam
|
|
|
|
|
Stephen T. Charlie wrote: I have a mail server used exchange 2003, but most of spam message in queues, i want to get an application used to delete the spam mail from queues, how to do it?
What do you mean with "want to get an application"?
Since this is a programming forum, first thing that comes to mind is the dev's documentation[^] for Exchange.
It'd probably be best to let Exchange[^] handle the spam itself.
Bastard Programmer from Hell
|
|
|
|
|
Hi, I got a task and I tried many ways to do but I couldn't find out how, I need to make a windows service that will return Access is denied when a user in admin group tries to disable or stop the service. My service's CanStop property is false but when I open msconfig I could disable my service. However Eset Service return access is denied when I try to stop or disable it. Please help me. I want to do this because, we add our workers to administrators group on their computers so they can kill any of our control mechanisms when they want. This service will serve us to control their computers. Thanks.
modified 8-Feb-12 2:25am.
|
|
|
|
|
Just set the security rights of the service to administrator control only.
No other user will be able to restart this service then.
Set this in the installer
e.g.
Account = ServiceAccount.User,
Username = @"domain\username",
|
|
|
|
|
Hi thank you for quick answer but I don't want "Administrator group" to stop or restart the service. Because like I said we add our users to Administrator group.
|
|
|
|