|
It's blank, because he's getting his value from a newly created instance of the form.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
You are creating a new instance of the Mainfrm class. That instance will work independently from the one that already exists.
You have to use a reference to the form that already exists in order to access it's controls.
---
Year happy = new Year(2007);
|
|
|
|
|
Hi Guffa!
Could you give me a quick example.
1) myMainfrm.Show()
myMainfrm.GetTblID(Me) NAME OF FORM <"loggonfrm">
2)Public Sub GetTblID(ByVal TblID As Loginfrm)
txtTblID.Text = TblID.txtTableid.Text
End Sub NAME OF FORM<"Mainfrm">
Something like this?
Thanks!
Rudy
|
|
|
|
|
No - do NOT do this. Do NOT make your form elements public.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Well, your whole approach is wrong, your controls should not be made public. Instead, expose a property called TblId, or whatever.
rudemusik wrote: Dim MainFrm As New Mainfrm
This is your problem. You're creating a new MainFrm instance, which as no text on it. It's a different instance to the one that contains the text you want. You could get around this with a static property, or you can set up delegates to pass the info. It looks to me in this instance that you should either pass the value of the text to a constructor, or set a property that sets the GoodLuck label on this form, as MainFrm is obviously the class creating this one, and as you're handling the load event, it's obvious you want to set the text when the form opens.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thanks Chris!
I see where my problem is. So what are some of the reasons I don't want to use Public? I never gave it much thought. What harm could it do?
Thanks!
Rudy
|
|
|
|
|
It's just bad practise. The whole point of OO is to write objects that hide their inner workings. Expose only what you need to, which in this case, is a string, not a textbox.
IT's not that your program won't work, just that it's better to form good habits.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i'm using VB 2003, i want to make form with a button that open another form and in do some processes, and close the form, but i want my first form to know when it's done so i can do another process.
anyone have any ideas on how to do it ?
|
|
|
|
|
|
How can I make my application attach to multiple com application? I would like to provide a list of com applications installed on the user's pc.
For this reason I can't create a reference to the com object during runtime. It should be dynamic as per user selection. It could be an Excel, Word or other com application.
Summary
1) To get a list of all com applications available on the user's pc
2) To create a reference dynamical to what the user chose.
Thanks
|
|
|
|
|
|
Have you changed the property of the "anchor"?
|
|
|
|
|
Yes I changed it ,
Is any problem on that .?
thanks for reply
jooooo
|
|
|
|
|
What did you think it did ? It moves the control.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I think that Anchor propery is keep a constante distanse between a certain aidge of the form , like Top:Left ,,
I think that is useful on resizing the form ,,
it's it ,,,
if that is true then why the location of components is changing but themselfes ,, really
jooooo
|
|
|
|
|
you are correct. the anchor will also resize the control if you have both either off the opposite sides of the anchor set top/bottom or left/right.
if you have the windowstate set to maximize in design time, when you run the app, it could possibly move the controls depending on how you have the anchor set. if you have everything set as top/left (default) then none of the controls should be moved around...
|
|
|
|
|
Thanks for reply
I mean that the controls is changeing it's location at design time not at run time ,,
on every time I open the project I found that the location of controls is cahnged , on every time I found that the items is go to the right and bottom may be 2 point , on my project I'm using some components whick is designed by some friends like panels ,,
I'm installing vb.net 2005 service pack 1 ,
and the prlblem is still ,,
Really it's a thing make me wondered
jooooo
|
|
|
|
|
have you asked your friends if their components use anchors? maybe it's there stuff that is causing the confusion...
|
|
|
|
|
Allah bless you !
Thanks my frind and I will do ,
jooooo
|
|
|
|
|
hi could anybody help me with this problem.. im trying to extract icon form a file and put it into the imagelist and display this icon to the picturebox.. but i got error saying "system.drawing.icon cannot converted to system.drawing.image"..
|
|
|
|
|
If the icon you are extracting is of proper .NET icon format then you should be able to use the methods of the icon class to convert to a bitmap (.ToBitmap() possibly). If the file is not carrying any .NET native icons you will need to use icon API commands. Try searching the site here, I think I have seen at least one article on this.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
I am working on a Console application at I wish to use arguments with.
I am using VS2005 system.environment.getarguments...
This returns a string array separated by a space. This does not help if the arg I am trying to pass has spaces.
How to I set the GetArgs to use a - or / as the separate (switch)?
At present I am writing the array back as a single string and using split to separate in the - but this is wrong I know.
Does anyone have advice / tutorial explaining this.
Please NO cut and paste code....
Thanks
When people make you see red, be thankful your not colour blind.
|
|
|
|
|
japel wrote: This does not help if the arg I am trying to pass has spaces
Arguments usually are preceeded aith an escape character. Either '\', '/', or '-' for example. You can do your split and check out for that escape character at each of the splitted strings. If it starts with your escape char then it's a new argument. As long as it doesn't then simply append it to the previous one.
Regards
|
|
|
|
|
In the past I have done this with a getargs sub but why is there a system.environment.getarguments if it is so limited.
It must be how I am implementing it.
This was the way I was doing it.
<br />
Function GetCMDArgs() As String()<br />
' Declare variables.<br />
Dim separators As String = " "<br />
Dim commands As String = Microsoft.VisualBasic.Interaction.Command()<br />
Dim CMDargs() As String = commands.Split(separators.ToCharArray)<br />
Return CMDargs<br />
End Function<br />
When people make you see red, be thankful your not colour blind.
|
|
|
|
|
hi dear friends
how can i change datagridview header color in
.net 2005 - windows application(programatic or in design mode)
thanks & regards
zahra yousefi
yousefi105@yahoo.com
|
|
|
|