|
Hi all,
I would like to know whether it is possible to access form components from a class which is in another namespace. If not why did they decide to develop C# like that?
Many Thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Programm3r wrote: I would like to know whether it is possible to access form components from a class which is in another namespace
Yes.
|
|
|
|
|
Thanks you for the reply Pete.
Is it possible that you could perhaps give me an example or a link of which you may know where I can see such an occurance?
Many thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Hmmm.
namespace MyNamespace1
{
public partial class MyForm : Form
{
MyForm()
{
....
}
public string MyValue{ get ; set; }
}
}
namespace MyNamespace2
{
public partial class MyForm2 : Form
{
private MyNamespace1.MyForm _form
public MyForm2()
{
_form = new MyNamespace1.MyForm();
_form.MyValue = "Weyhey.";
}
}
}
|
|
|
|
|
Hmmm ... So The code below will create a new instance of the first form, right? Now wouldn't that throw away any data / text that would remain on the first form?
...
private MyNamespace1.MyForm _form
public MyForm2()
{
_form = new MyNamespace1.MyForm();
_form.MyValue = "Weyhey.";
}
...
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
I just showed you how to access a form in a different namespace. How you want to handle it is up to you.
|
|
|
|
|
Hi,
every time you execute new something() you create something new.
creating a Form is not the same as showing a Form; your new Form would be invisible until
you do something to it, such as _form.Show().
creating or showing a Form does not alter any other Form.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Any time that you are accessing something from the base class library, you are accessing code that lives in another namespace. For an explicit example, create a console application and observe the default namespace assigned to your code. Now, add a call to Console.WriteLine and output some text. If you place your mouse pointer over the word Console , you'll notice that it is a class defined in the System namespace. Thus, you have just accessed a class defined in another namespace.
I get the feeling, however, that this is not the question that you meant to ask. You may wish to try rephrasing so that your intended question is a bit more clear.
Hope that helps.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
The below unhandled Exception occur at application level, when 1000 records added in datatable which is bound to DatagridView and when click on scrollbar of Datagridview (The 1000 rows was added through code using while loop)
How can I handle or resolve the same.
System.ArgumentException occured
Message="InvalidArgument=Value of '5448' is not valid for 'rowIndex'."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.DataGridViewRow.GetStte(Int32 rowIndex)
at System.Windows.Forms.DataGridViewRowCollection.GetRowState(Int32 rowIndex)
at System.Windows.Forms.DataGridView.ComputeHeightOfFittingTrailingScrollingRows(Int32 totalVisibleFrozenHeight)
at System.Windows.Forms.DataGridView.set_VerticalOffset(Int32 value)
at System.Windows.Forms.DataGridView.DataGridViewVScrolled(Object sender, ScrollEventArgs se)
at System.Windows.Forms.ScriollBar.OnScroll(ScrollEventArgs se)
at ....................
|
|
|
|
|
Hi. I need to convert Word documents into image files using .NET, Jpeg, Gif, Bmp anything is fine. I searched through articles and message boards but couldn't find anything about this. There're word2image command line utilities but they're not free and I'd like to find any .NET and/or free solutions. Any ideas about how to do this?
Thanks.
|
|
|
|
|
There's nothing built in, your best bet is probably to control word to open the file and do a screen capture.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
You could always use something like Ghostscript to print to an image printer. There is an example here[^].
|
|
|
|
|
Could someone pse tell me how I may pass the following between forms:
I have a form with about 50 buttons and each opens a new form displaying a jpg picture (imported into Resources) in a PictureBox. When I close the form I'm back on the original form with the many buttons. It works pretty well but I think having just one extra form is more elegant - and less work!
I need to pass Image data like MyProject.Properties.Resources._142 (the pic is 142.jpg) to the form and then open it. Somewhere I saw that one can use Form dispForm = new dispForm(yProject.Properties.Resources._142) but the method does not accept a parameter.
I'm starting to like this language
Many thanks for any help.
Hannes
|
|
|
|
|
hbez wrote: Could someone pse tell me how I may pass the following between forms:
I have a form with about 50 buttons and each opens a new form displaying a jpg picture (imported into Resources) in a PictureBox. When I close the form I'm back on the original form with the many buttons. It works pretty well but I think having just one extra form is more elegant - and less work!
I need to pass Image data like MyProject.Properties.Resources._142 (the pic is 142.jpg) to the form and then open it. Somewhere I saw that one can use Form dispForm = new dispForm(yProject.Properties.Resources._142) but the method does not accept a parameter.
You can change the constructor in the form to accept the parameter. By default it's created without one, but there's no requirement that you have to leave it that way.
Alternatively, you could expose a property on the form that accepted the appropriate value and set it before calling Show().
|
|
|
|
|
hbez wrote: but the method does not accept a parameter.
You need to write the method that takes the parameter.
Or you can create the image as a property that is lazy initialised on a static class, making it load the first time it's accessed, and accessible from your entire project.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How to form regexp for ommiting hidden folders? I tried something like this:
^[A-Za-z]*
or
^\w*
but this doesn`t seem to work.
Thanks for help
|
|
|
|
|
Yoyosch wrote: How to form regexp for ommiting hidden folders?
That question makes no sense at all. What does a regex have to do with hidden folders ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yoyosch wrote: How to form regexp for ommiting hidden folders? I tried something like this:
^[A-Za-z]*
or
^\w*
What on earth is this? You don't string test to see if a folder is hidden or not?
|
|
|
|
|
No, WE don't do that. Apparently, HE does.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Suppose I don`t want any folders that have names started with dot "."
|
|
|
|
|
You don't need a regex for this. A simple test to exclude strings that StartWith('.') should do the job.
|
|
|
|
|
So how does the folder name starting with a "." make the folder "hidden"??
You might want to spell stuff like this out the next time you ask a question.
|
|
|
|
|
I remember it usually does on UN*X, although my UNIX days are long gone...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Yeah, I've since found out that you can't even name a folder starting with a period. An extension is optional, but not the filename.
|
|
|
|
|
Hi
Is there a way to turn off the edit functionality in excel when the user selects the export to excel funtionality from the report viewer?
Please let me know.
Thanks
J9
|
|
|
|