|
Judah Himango wrote: Not to mention the benefit of type safety is a huge boon IMO
I love type safety!
Jared Parsons
jaredp@beanseed.org
http://jaredparsons.blogspot.com/
|
|
|
|
|
I see. Thanks for the explanation Judah. I switched it to a class and it seems to be working ok. The function Marshal.StructureToPtr seems to still work with the class object. I've been using the windows journaling to synthesize mouse and keyboard stuff. Defining the EVENTSTRUCT as a class seems to work ok.
public class Win32
{
[StructLayout(LayoutKind.Sequential)]
public class EVENTSTRUCT
{
public uint message;
public uint paramL;
public uint paramH;
public uint time;
public IntPtr hwnd;
public EVENTSTRUCT (uint message, uint paramL, uint paramH, uint time, IntPtr hwnd)
{
this.message = message;
this.paramL = paramL;
this.paramH = paramH;
this.time = time;
this.hwnd = hwnd;
}
}
|
|
|
|
|
Hi there.
I made a form with some Label controls on and lines and stuff. I have managed to make the computer print it. However, I would now like to add some code that will allow me to print out a second page with stuff. There is where my problem lies The following code I added right after coding the very last thing that gets printed on the first page so the following is supposed to be printed on the second page:
e.HasMorePages = true;
Label svar1 = new Label();
svar1.Font = new Font("Times Roman", 12);
double result = double.NaN;
result = double.Parse(tnr1.Text) + double.Parse(tnr2.Text);
svar1.Text = result.ToString();
f.DrawString(svar1.Text, svar1.Font, new SolidBrush(svar1.ForeColor),
65, 1650);
e.HasMorePages = false;
This however yields nothing, only the first page gets printed. Can someone please help me? What am I missing?
Best regards,
FJ
|
|
|
|
|
|
Hi all,
Well I am trying to learn C# so I made up a poject for myself. It's a small program that makes a playlist so it can pass it to other applications. Well my problem is that I keep getting a Access To Path Denied. Here is a picture of my error:
http://www.streamload.com/half_ex/help.jpg
I have tried tweaking the .Net 1.1 Framework Configuration. Had no luck there and I read somewhere that you can go ahead and request the permission through code also. Well my main question is shouldn't I be able to write to disk since there is no security on the file I try to write to and also I am logged in as an administrator account? And also how do I go about having permission to write, read to my hard drive? Help Plz...Thanks
Lee
|
|
|
|
|
Can you post the full text of the exception? Also can you post the full text of the Build() method?
Jared Parsons
jaredp@beanseed.org
http://jaredparsons.blogspot.com/
|
|
|
|
|
Here is the Build()
public void Build()
{
//string to find the location of .exe
string directory = WhereAmI();
//name pulled from user and to name the playlist then add .mply extension
NAME = NAME + ".mply";
//set lentgh the of the strong minus 20
int temp = directory.Length -20;
//then cut the last twenty characters
NAME = directory.Remove(temp,20);
//then sets the directory to another vaiable
string FILE_NAME = NAME;
//create a streamwrite
StreamWriter writer = new StreamWriter(FILE_NAME);
//writes a line to the file
writer.WriteLine("This is a test again");
//close stream writer
writer.Close();
}
Then the error I get that is thrown is:
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
Additional information: Access to the path "C:\All Data\VS 2003 Projects\Tiny Mp3 Player\bin\Debug" is denied.
Thanks
Just ask if you need anything else.
Just Trying To Make It Through The Day!
|
|
|
|
|
Hey I know what I was doing wrong. I had to many variables around floating so I simplified it. What was happening was I was trying to write text to a directory. Not a file. Thanks for the help Jared!
Just Trying To Make It Through The Day!
|
|
|
|
|
Hello Firends
How can I open Microsoft Outlook to send email to the address with press a button in my
form ??
Thanks In advance
|
|
|
|
|
if outlook is the default email client on the pc then you could use this line of code:
System.Diagnostics.Process.Start("mailto:user@domain.com"); if outlook isnt the default email client on the pc, then whatever is will be opened.
-- modified at 12:18 Friday 30th December, 2005
|
|
|
|
|
1.
When a button is clicked on Form1 it handles the event by creating a new form, like this:
newForm *a=new newForm;
a.Show();
the problem here is that when Form1 is closed newForm disspaears is closed too.
how can a new a form be closed without closing all the forms it created?
2. in the above example newForm also has a button that creates an instance of Form1 when pressed. Form1.h has newForm.h included. the problem here is that when i try to include Form1.h in newForm.h i get an error saying that newForm is not defined in Form1 and Form1 is not defined in newForm.h.
m$: It is normal for your screen to go blank and for your computer to restart itself several times
|
|
|
|
|
in the OnClosing event do:
e.Cancel = false;
|
|
|
|
|
to close form1 i call form1.dispose();
that in turn calls components.dispose();
i dunno where to find the OnClosing event
anyway setting form1.cancel to false will still close the form whiel allowing it's chold forms to exist? i mean really lose it not just hide it.
what about calling Activator.CreateInstance(newForm); i've seen soem refereances to the functione but i have no clue as to what it does.
m$: It is normal for your screen to go blank and for your computer to restart itself several times
-- modified at 9:33 Friday 30th December, 2005
|
|
|
|
|
I do not think there is a way to close a parent form and keep its child forms open.
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
I think the best you can do is to make the parent invisible.
|
|
|
|
|
|
If you have binary data in an image field, you can't just write it out into the response stream. You have to make a proxy page that will get the data from the database and write it out. The proxy page will work just like if it was an image file. E.g.:
A hyperlink field in the database has nothing to do with an html hyperlink, it's a hyperlink that is used by Office applications. You can extract the data from the field and create an html link from it, but it's easier to do if you store the information in regular text fields instead.
---
b { font-weight: normal; }
|
|
|
|
|
How can i set a Location of a form then show it correctly?
If i make this:
MyForm f = new MyForm();
f.Locaion = myPoint;
f.Show();
it doesn't Locate the Form at myPoint position.
|
|
|
|
|
do it onLoad event and will work
|
|
|
|
|
Also, you have to make sure that the StartPosition property is set to Manual for the form.
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
i want to use for the standard button myown png images.
Using for the normal state one png, for the mousemove another and for mouse down another one too.
How?
|
|
|
|
|
Add a handler for MouseDown, MouseUp, MouseOver events for the Button and set the Image property accordingly.
|
|
|
|
|
Hello, here are some beginners questions
First, how do i get a form to return a value? If i allow the user to select something, like a object of some kind, how do i return this object to the class that called the form?
Secondly, how do i determine if a class fulfills a certain interface?
To clarify this question, i have this function that loads DLL:s but theese contain many classes, and i wont it only to load those classes that implements the IMyForm interface, please advice
private Form loadPlugIns(String dllName) {<br />
try<br />
{<br />
Assembly MyAssembly = Assembly.LoadFrom(dllName);<br />
Type[] Types = MyAssembly.GetTypes();<br />
<br />
foreach (Type oType in Types)<br />
{<br />
try<br />
{<br />
if ((oType.IsClass == true))<br />
{ <br />
object ibaseObject = Activator.CreateInstance(oType);<br />
Form form;<br />
form = (Form)oType.InvokeMember("getForm", BindingFlags.Default | BindingFlags.InvokeMethod,<br />
null, ibaseObject, null);<br />
return form;<br />
}<br />
} catch (Exception ex)<br />
{<br />
VirheHallinta.LogException("Failed to load module.", ex);<br />
}<br />
}<br />
return null;<br />
} catch (Exception ex)<br />
{<br />
System.Windows.Forms.MessageBox.Show(ex.ToString());<br />
return null;<br />
}<br />
}
Hm, looks awfull (my code) in the window...
R
Johan
-- modified at 6:01 Friday 30th December, 2005
|
|
|
|
|
Hi,
1. There are several prossibilities.
a) Show the Form as you would normally with ShowDialog and add a property to it so the result can be retrieved afterwards. This is like the built in dialogs of .Net work.
b) Define your own ShowXY function in your form which internally calls ShowDialog on himself and returns the wanted result:
public MyObject ShowMyForm(){
if (this.ShowDialog() == DialogResult.Ok)
return _myResult;
else
return null;
}
2. There are several way to do this. One is:
if (Array.IndexOf(t.GetInterfaces(), typeof(IMyInterface)) >= 0)
Console.WriteLine("Interface implemented");
else
Console.WriteLine("Interface not implemented");
|
|
|
|
|