|
class Foo{
public enum OutputFormat {
HEX,
BINARY
DECIMAL
}
...
}
You can also use private to make the enum only useful within the class.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'm a retard. I could swear that I retried that and got a compiling error!
It works now.
Thank you very much, I can stop banging my head on the desk.
|
|
|
|
|
dino2094 wrote: I'm a retard.
*grin* everyone is a retard, sometimes.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello,
I have an application that saves files to the server. Users don't have the righ to edit any of the documents in the file system. One way to do it, is to use impersonation to modify the files, however in Win 2000 for impersonation to work one has to modify the security policy, which poses the security risk. So my question is, how can I allow the users to modify files on the file system only through the application?
Thank you.
|
|
|
|
|
Hi folks,
Here's my problem: (and the source of my frustrations)
I'm writing an app to control a service.. Now, the settings of this service are kept in a serialized file, which is the serialized form of my configuration - object...
The user should be able to specify certain settings by pressing a button,
so what I do is passing an instance of the configuration class to the SettingsForm.
e.g. frmSettings formsettings = new frmSettings(myConfiguration);
now for the big question: How can that frmSettings RETURN the modified myConfiguration to the parentform without having to go to the trouble of serializing the stuff, writing it to the disk and deserializing it again in the parent form...
Thank you very much for your response!
A young c# programmer
|
|
|
|
|
|
I don't see the solution here on first sight.. I'm really trying to return an instance of an object (not a value) when the user chooses to commit the changes...
|
|
|
|
|
motojojo wrote: I'm really trying to return an instance of an object
Yes, and a value is.... an instance of an object.
|
|
|
|
|
hi all, i m making winform application which draw shapes on form,i have problem related to the drawings,when i clikc on the button then shape is drawn but when,form is minimized then then drawing bcome clear, i had done most of programming in vc++ i know in VC++ we create the virtual window to remove that problem. but how to solve the redraw problem in C#,any help is welcomed.
Regards.
Tasleem Arif
|
|
|
|
|
You need to put all of your painting code in your form/controls Paint event.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
LOL - you beat me by microseconds.
I'm at the summit, shame you couldn't make it. It's been pretty cool.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: I'm at the summit, shame you couldn't make it. It's been pretty cool.
Crap! Hopefully next year!
Next time you're in Toronto, let me know. I'll see if I can convince the wife we need a quick get-a-way to Niagra Falls or something! Besides, it'd be interesting to see where all this CP stuff, my wife calls it "porn", in stored.
Christian Graus wrote: LOL - you beat me by microseconds.
You gotta be quick around here!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: Next time you're in Toronto, let me know.
Next Wednesday... Or, did you mean after that ?
Dave Kreskowiak wrote: You gotta be quick around here!
Yeah, it's getting that way.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: Next Wednesday... Or, did you mean after that ?
Yeah, after that! I'm a bit broke right now.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
In C++, you should have done the same thing you should do in C# - draw your shapes in the Paint event handler of the form, so it gets told to redraw itself when the form is obscured in any way and then shown again.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thanks a lot.
Regards.
Tasleem Arif
|
|
|
|
|
I am using c# 2005 express Edition and want to create a report in crystal report. I do not see any crystal report icon in the toolbox. Any idea?
-- modified at 7:58 Thursday 15th March, 2007
|
|
|
|
|
Appologise for my earlier post, as mention before i am a new programmer and my posting etiquette needs improving.... again i appologies.
Can anyone help me with a problem of loading in a backgroun onto my form. I know you can load a picture box from the tool box and set this as your background but this is not what i'm try to achieve.
The problem appears to be in this line of my code (code added at bottom)
Bitmap background = new Bitmap(GetType(), "background.jpg");
I get the following error when press F5 to run my app.....
Resource 'background.jpg' cannot be found in class 'Game.Form1'
I have added this image as a resource (solution explorer > title properties > resources > add image.
This is my code in full:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data;
namespace Game
{
public partial class Form1 : Form
{
// insert private bitmap background
// and movement int x/y move etc.....
private Bitmap background = new Bitmap(640, 320);
//private Bitmap car;
//private Bitmap player;
public Form1()
{
InitializeComponent();
//player = new Bitmap(GetType(), "player.jpg");
//car = new Bitmap(GetType(), "car.jpg");
Bitmap background = new Bitmap(GetType(), "background.jpg");
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.UserPaint, true);
Graphics g = Graphics.FromImage(background);
for (int x = 0; x < 640; x += 90)
for (int y = 0; y <= 290; y += 90)
{
g.DrawImage(background, new Rectangle(x, y, 90, 90)); // GraphicsUnit.Pixel);
}
}
}
}
Regards,
Thank you for taking the time to read this
|
|
|
|
|
If you've added the image as a resource, and you're using Visual Studio 2005, you can access it like this:
Bitmap playerBitmap = Properties.Resources.player;
|
|
|
|
|
This is a very strange problem I came across and it's a show stopper for my current app. It happens all the time on the site I'm trying to interact with and it occasionally happens on google.com (or any site I'd imagine).
I'm trying to run a series of events depending on what URL is currently being navigated.
In my WebBrowser's DocumentCompleted event I have a switch which runs a different set of methods based on the URL.
After a document is complete, it'll run the switch fine but it runs what's inside of the case I'm trying to detect more than once. It's easy to see by placing a messagebox output. It'll come up 2 times instead of once.
I tried other ways of determining which page I'm currently on. Like using the DocumentTitleChanged event instead of DocumentCompleted, but I think DocumentCompleted is safer because it won't do anything until the document is loaded. Either way, the problem exists with DocumentTitleChanged too.
Any ideas? Btw I excluded the site where it occurs all the time because it requires a login and unfortunately I can't share it publicly. If you want to do a test, just throw together an app really quick and drop a messagebox into the DocumentChanged event, then have a textbox where you can enter different addresses -- it's bound to come up.
|
|
|
|
|
ThisIsMyUserName2 wrote: It happens all the time on the site I'm trying to interact with and it occasionally happens on google.com (or any site I'd imagine).
ThisIsMyUserName2 wrote: Any ideas?
They hide that information in the DOCUMENTATION[^]
Remarks
The value of the URL parameter might not match the URL that was originally given to the WebBrowser Control. One possible reason for this is that the URL might be converted to a qualified form. For example, if an application specified a URL of www.microsoft.com in a call to the Navigate or Navigate2 method, then the URL passed into DocumentComplete is http://www.microsoft.com/. In addition, if the server has redirected the browser to a different URL, the redirected URL is passed into the URL parameter.
The WebBrowser Control fires the DocumentComplete event when the document has completely loaded and the READYSTATE property has changed to READYSTATE_COMPLETE. Here are some important points regarding the firing of this event.
* In pages with no frames, this event fires once after loading is complete.
* In pages where multiple frames are loaded, this event fires for each frame where the DownloadBegin event has fired.
* This event's pDisp parameter is the same as the IDispatch interface pointer of the frame in which this event fires.
* In the loading process, the highest level frame (which is not necessarily the top-level frame) fires the final DocumentComplete event. At this time, the pDisp parameter will be the same as the IDispatch interface pointer of the highest level frame.
led mike
|
|
|
|
|
Hmm, what can I do to get what I'm looking to do working (only having it trigger once)? It still happens on the DocumentTitleChanged event, I'm out of ideas on determining which URL is currently being navigated.
Here are the cases I look for and the actions that take place depending on which step (URL) I'm on.
At a login screen
-- automatically login
-- goto the search screen
At a search screen
-- search for xx (a number that the user of the app enters which gets auto-incremented)
-- determine if the search returned a result
---- if it did, then move on to the "scrape phase"
---- if it did NOT, go back to the search screen and log it
-- auto increment (here's the part where having it load twice is killing me)
At the Scrape phase (which is the same URL as the search screen except it has a "#search_result" in the URL)
-- Parse out 2 URLs from the search result and navigate to the first address
At first URL result
-- Check for xx (which is entered in my app but will be a constant in the session)
---- if it found it, move onto the second URL
---- if it did NOT find it, go back to the search page
At second URL result
-- Scrape a few pieces of information and store it into a DataSet
-- Go back to the search page and start over
I can't use the WebClient class because it requires slight user interaction due to a random character generator (on their site) coming up on various steps of the procedure. To counter that I check the page source for a specific string that only exists when this page is shown and I perform this check before I run the switch.
|
|
|
|
|
ThisIsMyUserName2 wrote: what can I do to get what I'm looking to do working
Well since you have not stated "what I'm looking to do", I have no idea.
led mike
|
|
|
|
|
Something that would do exactly what DocumentCompleted/DocumentTitleChanged does except only fire once.
ie. Have the ability to figure out which URL is being navigated after a page is loaded and do something based on what URL that is.
|
|
|
|
|
Since you have zero control over the firing of events, I'll refer you to the red text[^] again. You can try counting the number of times the DownloadBegin event fires, incrementing a counter by 1. When the DocumentComplete event fires, decrement that counter. When you reach 0, the page should be done. You might want to double-check with the READYSTATE to see what it says too.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|