|
If the array is declared as public then all you need to do is preface the call to the array with form1
i.e textbox1.text = form1.myarray(0)
|
|
|
|
|
Personally this is a very BAD idea.
Forms are objects that should encapsulate the data within them. At no time should one object just simply reach out and grab hold of data inside of another object. This is really one of the major tenets of OOP design.
That does not mean that you can't talk between forms, but it should be done properly via an established interface.
You should be providing an interface (functions, methods, or custom properties) on your forms for allow that type of communication to happen. This gives you a way to not only gain access between data on forms the proper OOP way, but also gives you the ability to provide data validation, authentication when needed, and also perhaps some contention detection when that may be needed also.
Please, NO public variables on forms! Forms are objects just like a class is. You don't open up a variable inside a class by making it public, you provide an accessor method to get to it. RIGHT? That's how you are doing in in your classes? Please say yes?
Forms are no different.
|
|
|
|
|
What!? I just use Option PublicEverything so I don't have to think!
All kidding aside, though, Ray is right. Just need to make a public accessor for the array, and all is well.
|
|
|
|
|
Actually I think he might be better to just use a seperate module for his public data. The forms should only contain data that is very specific to that particular form (which usually means it doesn't need to be public). Everything else such as functionality should be in modules or classes.
|
|
|
|
|
I can agree there, but then you still should not just reach out form the form and access the public object. It should be passed to the form upon creation via the forms constructor.
NOTHING in my opinion should be simply accessible via being public.
|
|
|
|
|
My Apologies. Of course you are right. You should implement public properties rather than declaring variables Public in any Class. My Bad.
|
|
|
|
|
I want to show the WaitCursor when my app starts while it does some preparations before it shows the main form and starts the message thread.
So I can't use MyForm.Cursor = Cursors.WaitCursor because the message thread is not running yet.
Is there a way to change the windows cursor in another way?
|
|
|
|
|
Windows.Forms.Cursor.Current = Windows.Forms.Cursors.WaitCursor
Windows.Forms.Cursor.Show()
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
It doesn't work. Cursor stays normal.
|
|
|
|
|
the normal approach is to show a splash screen, which may or may not be animated. One way is like this:
Main() {
SplashScreen splash=new SplashScreen();
splash.Show();
SlowForm form=new SlowForm(splash);
Application.Run(form);
}
and the SlowForm could close the splash when it is far enough in its creation process.
BTW: if the SlowForm constructor is slow, you should consider postponing its slower parts ro a later event (Load, Shown) or even to a separate Thread.
PS: sorry, my example is using C#, you'll have to find the way to do something similar in VB.NET
modified on Monday, January 11, 2010 6:10 PM
|
|
|
|
|
Thanks, will try something like this.
|
|
|
|
|
Dear All,
I have a SQL database with 3 columns A, B, C. Under these 3 columns, there are 100 entries.
I want each row to be printed on each page of crystal report, so that i get a separate page for each row entries of the database.
Can someone suggest me how to implement this?
Regards
R.S.
|
|
|
|
|
You can check with crystal reports, from report field explorer, there is a field called Group Fields, there if you give your field as a group field, then your reports will be seperated by the same manner.
For Details, suppose your report like
S.No..Name...............Category
1.....Mr.Dave Kresoik....MVP
2.....You................Learner
3.....Me.................Learner
Now I added a Group By Field as Category, then PAGE-1
S.No..Name...............Category
1.....Mr.Dave Kresoik....MVP
And PAGE-2
S.No..Name...............Category
1.....You................Learner
2.....Me.................Learner
|
|
|
|
|
H0=[3/(5*sqrt(2)),4/5;-1/20,-3/(10*sqrt(2))];
H1=[3/(5*sqrt(2)),0;9/20,1/sqrt(2)];
H2=[0,0;9/20,-3/(10*sqrt(2))];
H3=[0,0;-1/20,0];
G0=[-1/20,-3/(10*sqrt(2));1/(10*sqrt(2)),3/10];
G1=[9/20,-1/sqrt(2);-9/(10*sqrt(2)),0];
G2=[9/20,-3/(10*sqrt(2));9/(10*sqrt(2)),-3/10];
G3=[-1/20,0;-1/(10*sqrt(2)),0];
H=[H0,H1,H2,H3];
G=[G0,G1,G2,G3];
B=zeros(2*k1,2*k2);
for i=1:4:2*k1
if (i+7)>(2*k2)
B(i:i+1,i:i+3)=H(1:2,1:4);
B(i+2:i+3,i:i+3)=G(1:2,1:4);
B(i:i+1,1:4)=H(1:2,5:8);
B(i+2:i+3,1:4)=G(1:2,5:8);
else
B(i:i+1,i:i+7)=H;
B(i+2:i+3,i:i+7)=G;
end
end
and the code
[k1,k2]=size(A);
WW2=gen2(k1/2,k2/2);
FF=ipermutesub(A);
FT=FF';
EE=ipermute2(FT);
DPP=WW2'*EE;
DD=icspreproc1(DPP);
CPP=DD';
CC=ipermute2(CPP);
AAP=WW2'*CC;
B=icspreproc1(AAP);
|
|
|
|
|
Soooooooo......what's the question?
|
|
|
|
|
I have a context menu running for a vb.net windows service controller I've created.
Folks can turn the windows service on and off with the application. I change the caption for the local mene each time the user changes the service status. (Startup service/ shutdown service)
This works great until somebody changes the service status independantly of my service controller. Then the captions don't match.
I'd like to capture the "right click" event of my context menu, so to speak, to make certain I have my service's status displayed correctly. I don't know how to do this with a dynamically created context menu.
I can add events associated with specific menuitem w/i my context menu without issue.
|
|
|
|
|
It's not very clear where you want this code to run. Are you saying that you have a context menu that pops up on a right-click of a form or some other control and you want to update the status then? Or do you want to update the status when right-clicking an item in the context menu??
It's easy to wire up the events using AddHandler. You just have to write the method up with the correct header, matching what the event you're going to use expects.
|
|
|
|
|
JaeBeam wrote: This works great until somebody changes the service status independantly of my service controller. Then the captions don't match.
Would it be an option to get the latest status and setting the caption, just before the menu is about to pop up? In that case, you could wire up the PopUp[^]-event, and set the caption from there.
I are Troll
|
|
|
|
|
Is it possible to use all the Queries in Single DataAdapter, Dataset?
Also Iam using like the following
Dim Query1="Select * from Table1"
Dim DAp1 as SqlDataAdapter,Ds1 as new Dataset
Dim Query2="Select * from Table2"
Dim DAp2 as SqlDataAdapter,Ds2 as new Dataset
Dim Query3="Select * from Table3"
Dim DAp3 as SqlDataAdapter,Ds3 as new Dataset
con.open
DAp1=New SqlDataAdapter(Query1,con)
DAp1.Fill(Ds1)
DAp2=New SqlDataAdapter(Query2,con)
DAp2.Fill(Ds2)
DAp3=New SqlDataAdapter(Query3,con)
DAp3.Fill(Ds3)
con.close
Instead, Dap1.Tables(0), DAp1.Tables(1), DAp1.Tables(2) like wise, how to fill all in a single Dataset from SQLDataadapter?
THANKS
|
|
|
|
|
You can use multiple tables in the same data set. But, you cannot use a single DataAdapter to fill it. The DA's only work with queries that work on a single database table at a time. You CAN, like in your example, use multiple DA's on the same dataset.
|
|
|
|
|
i hav a table with schema
id int
name varchar
i declare trow as personrow
i bind it to a gridview onselectedindexchange i got the row selected by user as
dim row as gridviewrow = gridview1.selectedrow
how can i cast row to personrow
|
|
|
|
|
You don't. A GridViewRow represents the row in the GridView control, not the data inside it. You can use the returned GridViewRow object's DataItem propety to get a reference back to the data item that row is bound to.
|
|
|
|
|
hi
I form a loop display all do
|
|
|
|
|
In what context?
Are you trying to get the form names and show them in a list or are you really trying to show every form in your app?
|
|
|
|
|
Hi all,
has anybody work with data format "jdf"?
For example reading and writing?
Thanks for help
|
|
|
|