|
My implelentation is like this:
In Form1, Code is:
Sub Functioname()
{
GroupbBox1.Enabled = False
}
Now I want to enable this GroupBox1 through Form2 in following function:
Sub FunctionEnable()
{
''''' Code will come here
}
Please let me know how to call that GroupBox1 control so that I can use its properties in Form2.
Regards
R.S.
|
|
|
|
|
See the other reply to your question.
P.S. Besides that it seems you are on the wrong forum.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Do you have a reference to form1 in form2? If you do then just call the Functioname method directly. If not then change your structure to have a reference. If the forms are intrinsically linked like this then there is no point doing this with events.
|
|
|
|
|
Please see my requirement below carefully: need immediate help.
I have 2 forms, main Form1 and a loginform. When I start the application, first "Form1" is loaded and then with a button click, user can load "loginform" if required to enable/disable some features/controls on Form1.
The sequence is like this:
1) Load main form Form1
2) click a button on Form1
3) Load the loginform.
4) enter user/pwd and click OK button
5) enable/disable "GroupBox" control on Form1 if login sucessful.
For this,
I made a click event for OK button in loginform, so once user clicks the OK button, I want to call one function which is defined in Form1 as a Public, which enables/disables the "GroupBox" control on Form1. The code structure is like this:
in main Form1, i created a function like this:
Class Form1()
Public Function DoThis() ' Function to enable/disable GroupBox control
....some task...
End Function
End
now in loginform, in the click event for OK button:
Class loginform()
Click_OK()
{
DoThis().... 'call function DoThis() of Form1
}
End
I am not able to call the DoThis() function in loginform. Please suggest me with a piece of code how to do this??
Please remember that Form1 is my main form which is loading first. If anyother way is there to make a password protected feature for GroupBox control in Form1, it will be highly appriciated.
Hope my problem is clear..Thanks.
|
|
|
|
|
You cannot Enable / Disbale a tab directly. It does not have a property for this.
The recommended method on MSDN is to handle the TabControl SelectedIndexChanged event. you will need to have a flag somewhere that you can set to reflect the state of the tab (enabled/Disabled) and then check in this event which tab you are on and then move to another tab if you try to select it when it is disabled.
Search google for "How to: Disable Tab Pages" and you will find the article at MSDN.
Dave
|
|
|
|
|
Actually, you can disable tab pages. Read this[^] thread.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Didn't know that!
Although, i dare say if you are using unsupported methods (or hidden ones) and something breaks folling updates to the api, you don't really have a leg to stand on!
|
|
|
|
|
You need a reference for Form1 in Form2 so you can directly manipulate its controls and set its properties.
|
|
|
|
|
Hi Shameel,
I am sedning You the actual scenario where I am using multiple forms this:
I have 2 forms, main Form1 and a loginform. I made a click event for OK button in loginform, so once user clicks the OK button, I want to call one function which is defined in Form1 as a Public. The code structure is like this:
in main Form1, i created a function like this:
Class Form1()
Public Function DoThis()
....some task...
End Function
End
now in loginform, in the click event for OK button:
Class loginform()
Click_OK()
{
DoThis()....call function DoThis() of Form1
}
End
I am not able to call the DoThis() function in loginform. Please tell me how to do this??
Hope my problem is clear..Thanks.
|
|
|
|
|
To call a function on Form1, you need a reference to the form in your loginform. It depends on where you instantiate Form1 in your app. Assuming that you instantiate Form1 in loginform (since loginform should ideally be the first form that is loaded in your app from main() method), the code could be something like this:
Form1 form1 = new Form1();
form1.DoThis();
form1.Show();
|
|
|
|
|
my Form1 is the first form which get loaded. loginform is loaded on the click of a button on Form1.
Pls tell me how to do this.
|
|
|
|
|
loginform.cs
Form1 _form1;
public loginform(Form1 form1) {
_form1 = form1;
}
public DoSomething() {
_form1.DoThat()
}
Form1.cs
private button1_Click(...) {
loginform fLogin = new loginform(this);
loginform.ShowDialog();
}
|
|
|
|
|
Hey all,
I at a bit of a loss on what to look for here and kind of even how to word it. I am developing an application in .net cf that runs on multiple platforms, basically the 2 mentioned above. The program was originally written for the iPaq2215 running i guess cf 4.2 and then we started running the program on smart phones (plam treo 850s) running win 6.1. The application captures a signature, saves the file to a bitmap, prints the invoice details, load the bitmap, and prints it. When I print from the iPaq, the full image prints, when I print from 6.1 pro device, I loose about the right hand side quarter. I dont know enough about graphics and stuff, so I dont know if there is an issue with the SHLoadGraphics function rendering to the pixel resultion of the device or what. If it does render to the device resolution, does anyone have any ideas on how to downgrade the resolution of the newer devices to be able to print the full image. I have tried changing screen size, control size, changing the screen's autoscalemode, but to no avail. Also, I checked the properties of the images and both images contain the same properties (width: 239 pixels, height: 128 pixels, horzres: 96dpi, vertres: 96dpi). When I copy the image from the iPaq to the phone and print, I get the problem, when I copy the image from the phone to the iPaq and print, I dont have any issues. The printer in question is a Citizen CMP10BT, however I dont see the printer being the issue since I can print both images from the iPaq properly. I have also tried to save the image on the phone and load it into a smaller bitmap using the graphics utilities provided by 6.1 by creating a new bitmap with smaller dimensions, but this also ended up doing the same thing. Any ideas or guidance as to where to turn to on this issue would be greatly appreciated. As I prefixed this question with ealier, I am sorry if I am in the wrong spot or bad phrasing.
Thank you in advance for any help provided.
Kevin
|
|
|
|
|
I have finished my winform project. And now, i want to setting my application full screen mode. I tried, but my layout was not is the same as mode is before full screen. Help me to break problem. Thanks
|
|
|
|
|
By setting the Dock and Anchor properties properly for all your controls.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I don't think so, when u dock property not none, your control will bigger and get along the border's form. Thanks for your attention
|
|
|
|
|
Christian did say "when you PROPERLY" set the Docking on the controls. Also, you may have to redo the layout of your form and use other contain controls such as TableLayoutPanel and Panel controls.
I think it was funny when you said that you "finished" your app, now you want to change it. If that's the case, then it's not finished. Now you know what is meant by the term "feature creep".
|
|
|
|
|
cotdot11111 wrote: I don't think so,
Well, if you know the answer, why are you asking us ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
I'm sorry if i annoy you , I mean we have been discussing a problem and i just show my opinion. I tried your solution, but i can't get the result. So, could you give me a specific way( maybe a simple project with 1-2 button ) thank you very much. My email : khanhtruong.uit@gmail.com
I'm looking forward your help
Thanks again
|
|
|
|
|
I am not mailing you anything, if I did, you'd have my mail. The ANCHOR property is the one you're going to set for most controls. You can set as many sizes as you want, and those will scale. Just put two buttons on a form, and play with thier anchor properties, you'll get the idea.
I told you you needed to use the anchor property in my first post, so did the other person who replied.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi Everyone,
I want to do the following:
Press TAB To Jump From one Textbox To Another Textbox in a Form.
How to implement this? Can someone help me on this?
Regards
R.S.
|
|
|
|
|
this is already natural behavior as long as you have the tabindex of the 2nd textbox set to 1st textbox.tabindex+1?
'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
|
|
|
|
|
Can You please elaborate a little bit more, as I have already created 8 textboxes and want to implement what You said?
|
|
|
|
|
When in form design, click the VIEW menu and select the menu item, TAB ORDER, you can then click the controls on the form to establish what the order will be when you press the tab key.
If you do not what a control to take part in TAB ORDER, set its tabcontrol property to false.
Alternate method for setting tab order, is to manually set each controls tab index property to a number. The first method is the best option.
|
|
|
|
|
Hi All,
Writting an ASP.NET app, I'm connecting to an sql database, connection is 100%, I just need the code to store a column value on a defined variable, I dnt want to diplay it jst the code to read the column value.
Dim connCatapult As New OleDb.OleDbConnection("Provider=SQLOLEDB;Data Source=CATAPULT;Initial Catalog=Catapult;Integrated Security=SSPI")
Dim daCatapult As New OleDb.OleDbDataAdapter("Select TestUserLoginDetails.UserName, TestUserLoginDetails.Password FROM TestUserLoginDetails", connCatapult)
Dim dsLoginData As New DataSet()
Dim strUsername As String = Login1.UserName
Dim strPassword As String = Login1.Password
daCatapult.Fill(dsLoginData, "TestUserLoginDetails")
'connCatapult.Open()
'**********This is all that i'm trying to do*****************
Dim strDbUserName As String
strDbUserName = ????????????????????
'********************************************************
please assist
|
|
|
|