|
Your english is fine, you got the correct forum and I see no problem with your code.
I never use PerformStep so I can't comment, I set the value explicitly eg: ProgressBar1.Value = 25
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
ohh, thanx for the reply, but it also didnt work for me ,
n wat happns is, whn a class is called n its doing operation , the runnig form shows the message "NOT RESPONDING" tht is i cant select or stop the process from the form.. please can any one help me out from this??
|
|
|
|
|
It says "NOT RESPONDING" because you're code is block the apps ability to process it's message pump. This is why when your setting the Text of a label or trying to increment the progress bar, it appears as though nothing is happening. Your doing all of your apps long-running work on the UI thread, blocking the app from picking up the Paint messages, sitting in it message queue, to repaint the controls.
To keep the UI responsive, you're going to have to move the long-running process code to a background thread. You may want to look into the BackgroundWorker component in the Toolbox.
|
|
|
|
|
ohh, its a new task for me, i nver had used a background worker before, i'll try it, but can u please help me out , how can i use it?? i mean how to achive it using bckgroud worker?? sorry sir, i m new in this programming world so its difficult for me to develope those code , if u please help me figuring out, or can guide me how can i achve it, it'll be yr gr8 support, thank u ..
|
|
|
|
|
|
I am using the following code to create a new record in my database. If I try to edit this record after it is created I have issues. If I create the record and stop the program, restart it, then I can edit the info correctly. Any suggestions on what I am doing wrong? Am I asking too vague of a question here? Obviously I am stupidly new to this and I apologize in advance for my ignorance.
Private Sub newagent()
Dim myagentadd As New agentadd()
myagentadd.agentid = 0
Dim result As DialogResult
result = myagentadd.ShowDialog
If result = Windows.Forms.DialogResult.OK Then
Dim agent As HVDataSet.AgentRow
agent = myHVDataSet.Agent.NewAgentRow
agent.Agent_Address = myagentadd.agentaddress
agent.Agent_City = myagentadd.agentscity
agent.Agent_Company = myagentadd.agentcompany
agent.Agent_Email = myagentadd.agentemail
agent.Agent_First = myagentadd.agentfirst
agent.Agent_Last = myagentadd.agentlast
agent.Agent_Phone = myagentadd.agentphone
agent.Agent_State = myagentadd.agentstate
agent.Agent_Web = myagentadd.agentwebsite
agent.Agent_Zip = myagentadd.agentzip
myHVDataSet.Agent.AddAgentRow(agent)
Dim rowsaffected As Integer = 0
rowsaffected = AgentTableAdapter.Update(agent)
If rowsaffected > 0 Then
ToolStripStatusLabel1.Text = "New agent added named : " & myagentadd.agentfirst
Else
MessageBox.Show("Please try adding this agent again, my horseshit program has failed you")
End If
Else
End If
AgentTableAdapter.Update(myHVDataSet)
myagentadd = Nothing
End Sub
|
|
|
|
|
What code do you use to edit the record after adding it? What error message do you get or what does/doesn't work when you perform the edit?
|
|
|
|
|
I think it is a design issue, your parent form creates a dialog where the user enters the data and closes the dialog, then your parent form adds the record to your dataset and uses the table adaptor to update the database. I would do it differently.
parent form gets the ID of the record or 0 for a new record
instantiate the dialog passing the ID to the constructor
dialog gets the table/record based on the ID (empty table if new)
dialog creates a new row in the dialogs table adding any default information
dialog SAVES the record to the database when the user is finished
dialog passes the dialogresult to the parent form
parent form RELOADS the datatable if there has been a change from the dialog.
This style services both Add and Edit of a record, moves all the manipulation logic to the dialog and insures the database is up to date with the data.
The real drawback is that there is an additional read to refresh the parents datatable. I have been using this style of development for decades and it works perfectly for corporate CRUD.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
First off, thank you both very much for you responses. I know this is super mundane for you but I appreciate the help like you can't believe. Try to answer both posts with this. Basics is this, I am a mortgage lender, I work with real estate agents, we have a new lead generation system in place. Want to be able to record and report data back to them on what is taking place. Tables are Agent(recording specific agents info) property (linking descriptions to certain props and referencing specific agents to that prop) and Caller(keeping info on the people calling in)
The code I originally posted is located in my main form. I am using the showdialog as part of a new form loaded when someone wants to do something. This code you saw is written into my main form. In Mycroft's comments I know that is the problem, the last part about updating the parent form once I send info into the DB. Can't really figure out what I am doing wrong though. In regard to Kschuler's comments, here is the code I use to update the record once it is passed in(again through the main form when someone selects update an agent), what I cant figure out is why I cant start the program, add an agent, then turn around and update the record. If the program shuts down, starts up again, my code functions perfectly. If I try to do it all at the same time the error comes back telling me that my edit function is trying to add a new agent. Even though the code returns a value that specifies what agent I am trying to update. Variable selected agent is = the one I want to select, but the program thinks I am trying to add a new agent. This probably also has to do with another problem I am encountering when I databind a listbox to my agents first and/or last name and once I move away from the first agent listed, that agent disappears in the list box.
Private Sub upagent()
Dim myagentup As New Agentup
Dim result As DialogResult
result = myagentup.ShowDialog
If result = Windows.Forms.DialogResult.OK Then
Dim selectedagent
selectedagent = myagentup.TextBox1.Text
Dim agent As HVDataSet.AgentRow
agent = myHVDataSet.Agent.FindByAgentID(selectedagent)
agent.BeginEdit()
agent.Agent_Address = myagentup.agentaddress
agent.Agent_City = myagentup.agentscity
agent.Agent_Company = myagentup.agentcompany
agent.Agent_Email = myagentup.agentemail
agent.Agent_First = myagentup.agentfirst
agent.Agent_Last = myagentup.agentlast
agent.Agent_Phone = myagentup.agentphone
agent.Agent_State = myagentup.agentstate
agent.Agent_Web = myagentup.agentwebsite
agent.Agent_Zip = myagentup.agentzip
agent.EndEdit()
Dim rowsaffected As Integer = 0
rowsaffected = AgentTableAdapter.Update(agent)
If rowsaffected > 0 Then
ToolStripStatusLabel1.Text = "Updated record for Agent: " & myagentup.agentfirst
Else
MessageBox.Show("We were unable to process the request you gave, please try again.")
End If
End If
myagentup = Nothing
End Sub
|
|
|
|
|
Sorry to both of you. I have learned what I know of VB in the last two weeks. Basically your both speaking sputnik for the most part. I am sorry if I don't catch the nuances of what your saying. Want to talk mortgages, I'll blow your head off! =]
|
|
|
|
|
Hello,
I have develop a windows application in VB in which using web browser control I have embedded office word.But the problem is that I can't access content of word.So Pls help me.
Thanks in Regards.
|
|
|
|
|
There is no way to get at the content of the embedded word inside the browser control. You're going to have to completely rework your design to avoid using the browser control if you need to get at the Word document content.
|
|
|
|
|
i have a GL table in which code,desc,debit,credit field
i have a customer talbe in which opening balance come
i want to caclulate opening balance in crystal report
where user prompt for date
also i need a general ledger database in microsoft acess
plz advices thanks
|
|
|
|
|
adnanbilwani wrote: i have a GL table in which code,desc,debit,credit field
i have a customer talbe in which opening balance come
i want to caclulate opening balance in crystal report
where user prompt for date
So write a parameterized query into the database to return the opening balance from whatever date is passed in. You can then use the result in your CR report.
adnanbilwani wrote: also i need a general ledger database in microsoft acess
There is no chance that anyone is going to just GIVE you this. You have to write it yourself.
|
|
|
|
|
Hi all
- I am trying to disable all Textbox in GroupBox
- I am trying to filter the controls in a form so I can get only Textbox
The code I managed to do is this (which is working fine)
For Each _TextBox As Object In Me.GroupBox1.Controls
If TypeOf (_TextBox) Is TextBox Then
_TextBox.Enabled = False
End If
Next
I have 3 questions.
Q1: After I type the dot in "_Textbox." I see the object property is shown up in the intellisense because I had declared the variable _Textbox as Object , but when I am trying to declare it as Textbox it gives error message
For Each _TextBox As TextBox In Me.GroupBox1.Controls
{"Unable to cast object of type 'System.Windows.Forms.Label' to type 'System.Windows.Forms.TextBox'."} PS: I have Label in the groupbox
Q2: I am able to get only the textbox by doing (For Each + TypeOf), cannot I do it in single line or command?
Q3: In VFP there is a method belong to the form called SetAll , it works like this, form1.SetAll("Textbox","Enabled","False") .
Is there similar method in vb?
TIA
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Try changing:
For Each _TextBox As Object In Me.GroupBox1.Controls
If TypeOf (_TextBox) Is TextBox Then
_TextBox.Enabled = False
End If
Next
to:
For Each _TextBox As Control In Me.GroupBox1.Controls
If TypeOf (_TextBox) Is TextBox Then
_TextBox.Enabled = False
End If
Next
you might even be able to get away with:
For Each _TextBox As Control In Me.GroupBox1.Controls
If _TextBox Is TextBox Then
_TextBox.Enabled = False
End If
Next
Hope this helps.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Henry Minute wrote: If _TextBox Is TextBox Then
The above does not works.
I change Object to Control, It is better to work with it like this.
Thanks for the Idea.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
I would use
For Each _Ctrl As Control In Me.GroupBox1.Controls<br />
If TypeOf (_Ctrl ) Is TextBox Then<br />
(Textbox)_Ctrl.Enabled = False<br />
End If<br />
Next
Q2 yes thats correct you need to test each control in the groupbox
Q3 - nope, no such animal.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: Q2 yes thats correct you need to test each control in the groupbox
Thank you for the confirmation.
Mycroft Holmes wrote: Q3 - nope, no such animal.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
I Guess I had Found what I was searching for.
For Each _Ctrl As Control In Me.GroupBox1.Controls.OfType(Of TextBox)()
No Need for TypeOf in the second line.
Thanks for all who replied to my post.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Cute - nice piece of code!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Halo,
Iam very new to vbnet so i need help to solve the following,
i have a database file with students exams information whereby a student
participated in 8 subjects.
now i want to get the count of the students who got A, A-, B+ etc in
evey subject and in every class i. e.in form1 form2 e.t.c where subject
marks <>n/a (not applicable)
I also need to count the number of students who participated in every subject where
subject_mark <> n/a-
and also get the average in every subject.
I also want to show and print this information in crystal reports or ms-reports in
vbnet 2005 pro.
i would be very happy if i get anycode sent by email.
Thank you.
|
|
|
|
|
This sounds suspiciously like a class assignment.
You must do your own work young man.
Firstly no-one will ever write your code for you, you must write your own, and people will help you out.
Secondly, you are asking for a lot, don't. Ask for a little each time.
Also, have you tried Here[^] I find it helpful.
------------------------------------
"Children today are tyrants. They contradict their parents, gobble their food and tyrannize their teachers. I despair for the future."
Socrates 400BC
|
|
|
|
|
Jimnahsh wrote: i would be very happy if i get anycode sent by email.
I bet you would, however this is generally called cheating where I come from. Do your own homework, or at least attempt it and come back with specific problems.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Thank you for being concerned about the complex question-
but surely i am not a student but my project is real, i had been
programming with vb6 but wanted to get the depth of the net
this is an example where i tried to get the results in v6 but found that if i use aloop the code could be to long:
Set conn = New ADODB.Connection
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Program files/Ease_Mark2010/ExamsFile.Mdb;Persist Security Info=False"
Set rs = New ADODB.Recordset
Dim strSQL As String
strSQL= "SELECT Count(*) AS [Mean Grade]From Results WHERE (((Results.[Mean Grade])='B-'And (Form_ID)='2")
from this code i was getting the correct rusults for the selected class.
The question is, i have 12 arugements for one class (A,A-,B+, etc)
and also 12 subjects to loop through.
therefore i wanted a clue to get used with vbnet 2005.
thank you.
|
|
|
|