|
Try changing fProc to the following.
<br />
public void fProc(){<br />
<br />
editForm edtFrm = new editForm();
...someText...<br />
if( ... )<br />
{<br />
editForm.cmbBox.DataSource = fieldsBaseD;
Application.Run(editForm);<br />
}<br />
}<br />
Jared Parsons
jaredp@beanseed.org
http://jaredparsons.blogspot.com/
|
|
|
|
|
It helped. Thank you very much!
|
|
|
|
|
hey. im kinnda new to the programming world. well i just want to know how do i start programming in C#, i mean like any good book to rec. or something that actually eexplains the basic. thats all i need the basic. i dont really hhave any strong backkground. i done vb6 before but i suucked at it and some pascal too. thx.
|
|
|
|
|
Jesse Liberty's "Programming C#" might be what you're looking for. It spends a lot of time explaining the basics before moving on to advanced topics. Its what I used to learn C#(although I did already have skill in C++).
|
|
|
|
|
if i were in your position, i would recommend starting with a bit of programming theory. I dont know how familiar you are with the Object Oriented Paradigm but i would definatley start on literature that is indepenedent of a programming language. The internet is GOLD for literature out there. Wikipedia.com has a lot about Object Oriented Analysis and Design, and Design Patterns. Here is my suggestion:
1. Learn Object Oriented Analysis and Design and what it all means (google it and read up on it at Wikipedia...there is so much out there and i hope you enjoy the theories presented)
2. Learn about design patterns: these are frequently reoccuring problems that show up in many programming projects (there are apporoximatly 30 or so patterns). This will provide a good base for solving problems.
3. Search of "best programming practices in C#", this will get you used to the language its, syntax and what is considered elegent coding.
4. Start learning the .Net framework (www.microsoft.com and F1), there are a lot of examples at microsoft.com, they have 30 examples that show some basic GUI interactions and many other basics that will prove to be useful
5. If you are rusty on looping, branching, function calling and some simple coding logic then start with console based projects. And play around with it.
The key to becoming a good programmer is to have a good understanding of software design. With a good base (steps 1-3), any programming language will come easy to you. If you just want to jump right in then i would check out the c# examples on Microsofts website. They will definately give you a big jump start into c#.
good luck
|
|
|
|
|
if I have a statement like ..
myArrayList.Add ( new MyStructure );
does the structure get allocated on the heap or the stack? Seems like it should be the heap, but most of what I have read says structures are always allocated on the stack. I saw where if you assigned the results of the new to a local variable that it would be on the stack - that I can understand; but what about the case above? The stack just doesn't make sense to me, but I wanted to confirm.
Thanks,
Brett
|
|
|
|
|
All structures get stored on the stack. All classes get stored on the heap. This means MyStructure will get stored on the stack since it is a structure, not a class.
However, if you look at ArrayList.Add method, you'll notice it takes a System.Object as a paramter. Since System.Object is a class, there will be an expensive, slow operation known as boxing will occur: a new object will be created on the heap and will copy the MyStructure from the stack onto the heap.
And when you retrieve your MyStructure out of myArrayList, you'll need to cast it back to MyStructure, which will induce unboxing which is also overhead.
Boxing is slow, causes heap allocations, and eventually forces costly garbage collections. That is why you need a list that can hold MyStructure objects without boxing them. If you're using .NET 2.0, you can go
System.Collections.Generic.List<MyStructure> list = new List<MyStructure>();
list.Add(new MyStructure());
This will allow you to have a very fast & efficient list for storing MyStructure objects without any boxing.
|
|
|
|
|
Judah Himango wrote: System.Collections.Generic.List<mystructure> list = new List<mystructure>();
list.Add(new MyStructure());
This also comes with a cost (almost always small). Generic classes like any other must go through a JIT Compile the first time they are used/accessed. As you can imagine, the JIT'd assembly for all of the generic classes and methods for objects is the same since you are just manipulating a pointer. So as long as you are using reference types as your generic paramaters then you only suffer the JIT penalty once and also one memory overhead hit.
Structs are a bit different though since they are allocated on the stack and have varying range in sizes. The JIT'er is forced to JIT separate code for each different set of generic parameters that includes at least one ValueType. This means an extra JIT and the associated memory that comes with the JIT.
Jared Parsons
jaredp@beanseed.org
http://jaredparsons.blogspot.com/
|
|
|
|
|
Yep. Still quite a bit better than constantly boxing/unboxing, I'd say. Not to mention the benefit of type safety is a huge boon IMO.
|
|
|
|
|
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.
|
|
|
|
|