|
You're treating forms like a trail of breadcumbs. This is not the case. Forms create instances of other forms in a hierarchical fashion. If, say, Form1 creates an instance of Form2 to get some data, Form1 should call Form2's .ShowDialog method, not Show . This way, Form1 will know exactly when Form2 is closed and is free to grab any data it needs from it. Form2 should not care at all which form created it, nor should it care about what data it needs to pass back to the form that called it. It's not Form2's job to do any of this. Form2's job is just to get data from the user or whever, not to pass it around. Form1 should know which methods it needs to call on Form2, not the other way around.
|
|
|
|
|
Dave Kreskowiak wrote: You're treating forms like a trail of breadcumbs.
yeah I guess you're right.
Dave Kreskowiak wrote: Form1 should call Form2's .ShowDialog method, not Show
got it! Form1 calls upon data that form2 generates not form2 passes the data back to form1. Many thanks again for the tip!
Aim small, miss small
|
|
|
|
|
Iam using entity list in my project and i want to use the sort finction how can i use that?
Dim GiftList As New List_test
Dim ent As Ey_test
For I As Integer = 1 To 100
ent = New Ey_ps_giftvoucher
ent.Psgv_vchnumber = "V000" & I.ToString.PadLeft(3, "0")
GiftList.Add(ent)
next
Iam getting the sort finction in property of giftlist but i dont know how to use that??
GiftList.Sort
|
|
|
|
|
It's impossible to say considering we don't know which object you're looking to sort and which classes you derived those collection objects from.
|
|
|
|
|
Hi all..
I am creating an application using VS2005 and I have connected it with MS Access 2003.
I have used a splash form which displays the owner name and its company name.
The problem is when I am running program through VS2005 it runs well but when I am trying to run it seperately it is giving an error message "Program has stopped working. Send this report to Microsoft"
I have not used any referrence or any .dll file with program.
Help me to solve this problem...
Gagan
|
|
|
|
|
Without knowing what the app was doing at the time of the crash, or what the code looks like around that point, it's impossible to tell you anything useful, other than trying to run the debug version outside of the IDE, then, when it crashes, connect the debugger to it.
|
|
|
|
|
Hi all..
I wan't to know that how to check if program is started by a user or by system?
Help me...
Gagan
|
|
|
|
|
Check the applications current user?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi everyone, i'm developing an application for a takeout & delivery restaurant. Using VB 2008 and MS Access for database and this application is driven by database.
selected category will display its items and will be generated as a button at runtime.
i will use button array and fill they with item name as "data" and handle by Addhandler addressof functionName
question1: is there a better way than using array of buttons? can i dynamically generate these buttons and add handler?
question2: left click will simply plus 1 item according to the button, right click will substact 1 item. can anyone tell me how to do right click detection with buttons generated dynamically.
hopefully i am explaining my situation clear enough, please let me know if i'm not making it clear.
thank you for reading.
WillRain
|
|
|
|
|
Sure, you can dynamically generate buttons.
Create your new button:
dim myButton as new button
with myButton
.size =...
...
end with
me.controls.add(myButton)
Then add the handlers.
To differentiate between left and right click simply use in your button-click-event:
if e.mousebuttoons = mousebutton.right then ...
|
|
|
|
|
i understand that e.mousebuttons (e) is the system.windows.forms.mouseeventargs, and of course that if statement will catch if the right mouse botton is clicked.
my question is "e" from the button function paramter is a system.eventargs, not the system.windows.forms.mouseeventargs. how do i code it so i can get the mouseeventargs?
also the program seems like only detecting the left click at runtime unless i already create an object and select mouseUp, can you please explain a little more on this part? thank you.
WillRain
|
|
|
|
|
Hi Smithers-Jones:
I have solved those problems, thx.
WillRain
|
|
|
|
|
Hi All,
I am using vb.net2008 and sql server 2005
I have a form there is only one button and a label
and in button click doing some delete operation in the table. I need when I am Click the Button then a message will display on lable that "Deleting..." and after deletion the message will removed.
at the start of the Button Click I am writing :
lable1.text="Deleting..."
.
.
.
Then writing the code for deletion
After complete the deletion I am writing
Label1.text=""
The Problem is the label does not Shows its value, Or Shows when the deletion is complete.
So, What I am doing for it?
Arindam Banerjee
Sr. Software Developer
Rance Computer Pvt Ltd.
Kolkata (India)
|
|
|
|
|
There are better ways but:
1. create a boolean variable
2. add a timer to your project with a small interval
3. in the timer's tick event:
a. check for the status of the boolean
b. change the text of your label to "" when the boolean is true
c. set the boolean back to false
d. stop the timer
4. move the deletion code to its own sub and at the end of the
sub change the boolean variable to True
5. create a thread address of of your deletion sub
5. in the click event of your button:
a. start the timer
b. set the label's text to "Deleting..."
c. start your thread
My advice is free, and you may get what you paid for.
|
|
|
|
|
Try doing label1.refresh after setting the text each time.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
The problem is that this code is running on the UI thread. So, any time your actually executing code, your app is not processing messages from Windows, like WM_PAINT. This tells your window or control to repaint itself, including updating the text you see in a label.
You have two options. The first is very easy. put a Application.DoEvents line right after you set the .Text property of the label. But! There's a problem with this. This command tells the app to process all pending messages in the applications message pump, including other button clicks, or anything else you can click on in your application. This could have disasterous results if you're not prepared for it.
The second option is to move the code that does the deleting to a background thread. You may want to check into the BackgroundWorker component to simplify this about as much as you're going to be able to.
|
|
|
|
|
True dat!
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
I think the label does show "Deleting..." but you have Label1.Text = "" so it does show your message but it is changing it from the word "Deleting..." too quick for you to notice.
Lloyd J. Atkinson
"Logic will get you from A to B, but imagination will take you everywhere" - ALbert Einstein
I look at Microsoft, and turn to my poster on the wall saying: "Bang head here in case of stress".
|
|
|
|
|
Hi
I am trying to bind a control to a property ,but i keep getting an
Exception on the databindings.add part
"Object reference not set to an instance of an object."
though i have instanciated all my objects and within scope
where do i drop the ball ?
Thanks
Dim oMyClass As New TestClass("Test")
Dim oBind As Binding
oBind = New Binding("Text", oMyClass, "StringValue")
Me.TextBox2.DataBindings.Add(oBind)<----------exception
Imports System.ComponentModel
Public Class TestClass
Private m_StringValue As String
Public Event StringValueChanged(ByVal e As PropertyChangedEventArgs)
Public Property StringValue() As String
Get
Return m_StringValue
End Get
Set(ByVal Value As String)
m_StringValue = Value
RaiseEvent StringValueChanged(New PropertyChangedEventArgs("StringValue"))
End Set
End Property
Sub New(ByVal InitialValue As String)
m_StringValue = InitialValue
End Sub
End Class
modified on Friday, September 26, 2008 3:15 AM
|
|
|
|
|
a program that uses the Next method from an object of type Random to produce two positive one-digit integers. It should display a question, such as
How much is 6 times 7?
The student should then type the answer into a Textbox. Your program should check the student’s answer. If it is correct, display “Very Good” in a Label, then ask another multiplication question. If the answer is incorrect, display “Wrong Answer. Please try again.” in the same Label, then let the student try the same question again until the student finally gets it right. A separate method should be used to generate each new question. This method should be called once when the program begins execution and then each time the user answers a question correctly.
|
|
|
|
|
No offense, but did you wait till the last day of the semester to start on your homework?
The people here might help you out if you make an attempt to program this and get stuck and include the necisary information to help you (like you did in the visual studio post I answered). However, they are not going to just write the code for you especially since these are obviously homework assignments.
|
|
|
|
|
|
Well, having read your 6 posts, all I can say is you are a right lazy t*sser who doesn't deserve a pass at any level.
I do have one consolation though, with a bit of luck nobody will employ you in a computing role, so I'll never have to fix your code.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Ashfield wrote: so I'll never have to fix your code
You mean someone else's code ?
My advice is free, and you may get what you paid for.
|
|
|
|
|
Sadly, thats probably true.
Bob
Ashfield Consultants Ltd
|
|
|
|