473,804 Members | 3,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Label refresh problem in Vb 6.0

7 New Member
Dear Sir,

i am reading a text file line by line from vb and insert in oracle table through pl/sql procedure.
in text file record is 70000, in my code i make a loop to read data in loop and insert in a oracle through pl/sql procedure.
in a loop i make a counter in the starting of loop set counter value=1
loop is run 70000 time becos data in text file is 70000.
so i am display a label in the form the counter value display in label
and refresh label every time..but after some time label refreshing is stop..but processing is going on...but i dont know how label refreshing is stop........plz help me...

thanks
Akhtar Ali
akh_jhs@yahoo.c om
Mar 21 '07 #1
13 7782
ansumansahu
149 New Member
Dear Sir,

i am reading a text file line by line from vb and insert in oracle table through pl/sql procedure.
in text file record is 70000, in my code i make a loop to read data in loop and insert in a oracle through pl/sql procedure.
in a loop i make a counter in the starting of loop set counter value=1
loop is run 70000 time becos data in text file is 70000.
so i am display a label in the form the counter value display in label
and refresh label every time..but after some time label refreshing is stop..but processing is going on...but i dont know how label refreshing is stop........plz help me...

thanks
Akhtar Ali
akh_jhs@yahoo.c om

What is the datatype of the counter I that you are using in the loop.

Just create a test form , place a lable and place this code in form_load
//////////////////////////////////////////
Dim i As Long
For i = 1 To 70000
Label1.Caption = i
Next i
//////////////////////////////////////////
this should display the value 70000 on the label.

This is what you want. Just display the counter value.

thanks
ansuman sahu
Mar 21 '07 #2
AKHTAR ALI
7 New Member
What is the datatype of the counter I that you are using in the loop.

Just create a test form , place a lable and place this code in form_load
//////////////////////////////////////////
Dim i As Long
For i = 1 To 70000
Label1.Caption = i
Next i
//////////////////////////////////////////
this should display the value 70000 on the label.

This is what you want. Just display the counter value.

thanks
ansuman sahu
Dear Ansuman,

i have done this activity no problem becos its not connected to oracle,but my problem is diffrent when i read data from text file in a loop read one line and insert in oracle table .
each time read file line by line and insert in oracle ..i want to show counetr in my form using label how many line read from text file and insert in oracle...it works for some time ......but after some time cursor is busy and application is hang ....but proceesing is going on.....and in the screen counter is not increase.
due to cursor busy.so i am not able to understand why application is hang and cursor is busy......

Regards
Akhtar
Mar 21 '07 #3
devonknows
137 New Member
Dear Ansuman,

i have done this activity no problem becos its not connected to oracle,but my problem is diffrent when i read data from text file in a loop read one line and insert in oracle table .
each time read file line by line and insert in oracle ..i want to show counetr in my form using label how many line read from text file and insert in oracle...it works for some time ......but after some time cursor is busy and application is hang ....but proceesing is going on.....and in the screen counter is not increase.
due to cursor busy.so i am not able to understand why application is hang and cursor is busy......

Regards
Akhtar
I know exactly what you mean, i find this with loops with most programming languages ive seen, once the loop goes on for so long and you are doing a few things each loop the app appears to go into a non responsive mode, but infact is still running the loop.

I had the same problem (well similar) what i did was i made a timer to interval at 5 milliseconds, but create some private integers, for example

Expand|Select|Wrap|Line Numbers
  1. Private LineCount as Long
  2. Private Const MAX_LINES = 70000
  3.  
In your timer you could possibly put

Expand|Select|Wrap|Line Numbers
  1. if LineCount > MAX_LINES Timer1.Enabled = False
  2.  
get it to read the line, LineCount, and then once its done inserting into the db then set your label caption,

Expand|Select|Wrap|Line Numbers
  1. Label1.Caption = "Record " & LineCount & "/" & MAX_LINES
  2. LineCount = LineCount + 1
  3.  
then when your timer goes again it will work of the new LineCount number and Carry on till you hit MAX_LINES

Im not to sure if this will help you, and not tested, but i thought it might give you a little nudge in the right direction. Hope this helps

Kind Regards
Devon.
Mar 21 '07 #4
AKHTAR ALI
7 New Member
I know exactly what you mean, i find this with loops with most programming languages ive seen, once the loop goes on for so long and you are doing a few things each loop the app appears to go into a non responsive mode, but infact is still running the loop.

I had the same problem (well similar) what i did was i made a timer to interval at 5 milliseconds, but create some private integers, for example

Expand|Select|Wrap|Line Numbers
  1. Private LineCount as Long
  2. Private Const MAX_LINES = 70000
  3.  
In your timer you could possibly put

Expand|Select|Wrap|Line Numbers
  1. if LineCount > MAX_LINES Timer1.Enabled = False
  2.  
get it to read the line, LineCount, and then once its done inserting into the db then set your label caption,

Expand|Select|Wrap|Line Numbers
  1. Label1.Caption = "Record " & LineCount & "/" & MAX_LINES
  2. LineCount = LineCount + 1
  3.  
then when your timer goes again it will work of the new LineCount number and Carry on till you hit MAX_LINES

Im not to sure if this will help you, and not tested, but i thought it might give you a little nudge in the right direction. Hope this helps

Kind Regards
Devon.

Dear Devon..

i did ur process but it is again same problem

plz any body can help me..

Regards
Akhtar
Mar 29 '07 #5
vijaydiwakar
579 Contributor
Dear Sir,

i am reading a text file line by line from vb and insert in oracle table through pl/sql procedure.
in text file record is 70000, in my code i make a loop to read data in loop and insert in a oracle through pl/sql procedure.
in a loop i make a counter in the starting of loop set counter value=1
loop is run 70000 time becos data in text file is 70000.
so i am display a label in the form the counter value display in label
and refresh label every time..but after some time label refreshing is stop..but processing is going on...but i dont know how label refreshing is stop........plz help me...

thanks
Akhtar Ali
akh_jhs@yahoo.c om
see refreshing is done by processor if ur processor is not geting time to refresh the lable then the label seems to be unfresh but actual process is going on
to show the refreshing effect use doevents in ur for loop
Try it
Good Luck
Mar 29 '07 #6
AKHTAR ALI
7 New Member
see refreshing is done by processor if ur processor is not geting time to refresh the lable then the label seems to be unfresh but actual process is going on
to show the refreshing effect use doevents in ur for loop
Try it
Good Luck

My Dear

How to use doevent
give me 1 example.

regards
Akhtar
Mar 30 '07 #7
devonknows
137 New Member
My Dear

How to use doevent
give me 1 example.

regards
Akhtar
I believe that there maybe an easier way of making this happen, the doevent puts a lot of overhead code in but its designed to allow other parts of your program to be reactive, but as you your going up to 70000 i wouldnt have thought you need much reactivity out of it except possibly a cancel button...

i believe that this might help you, by using the refresh method, the form and each control has a refresh method for example
Expand|Select|Wrap|Line Numbers
  1. lblstatus.Refresh
  2.  
  3. or
  4.  
  5. frmMain.Refresh
  6.  
however i believe something like this code below will be something you might be looking for, if this doesnt work then id suggest using doevents, but ive tested this just the label as ive got writers block and cant think for life what to test it with hehe.
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Private lCount As Long
  3. Private Const MAX_LINES = 70000
  4. Private Sub Command1_Click()
  5.     Timer1.Enabled = True
  6. End Sub
  7.  
  8. Private Sub Timer1_Timer()
  9. If lCount > MAX_LINES Then MsgBox "Process Finished": Timer1.Enabled = False
  10.     ' do something here
  11.     '
  12.     ' Update a label with iteration count
  13.     lblstatus.Caption = "Iteration #" & lCount
  14.     ' refresh *only* the label
  15.     lblstatus.Refresh
  16.     ' increase the count
  17.     lCount = lCount + 1
  18. End Sub
  19.  
Let me know how this goes,
Kind Regards
Devon.

Reference to Refresh:
http://www.devx.com/vb2themax/Tip/18646
Mar 30 '07 #8
vijaydiwakar
579 Contributor
See budies if the problem is
U like to show the processing liek its now reading line no 1
line no 2
line no 3

in such cases use doevent like
dim i&
for i=1 to 70000
lbl.caption=i
doevent
doevent
next
try it
Good Luck
Mar 30 '07 #9
devonknows
137 New Member
Just to quote the URL above that i post for the DevX site, it will explain why if you are just wanting to show what your program is doing, i.e. in a label to use refresh, doevents are to allow the rest of the program to have a bit of reactivity, were if you have changed the label and it hasnt updated, the simplest thing would be to refresh it, for example a web page, when something doesnt load properly, refresh it. But the link above will explain all. Never been a big fan of doevents to be persoanlly honest. Its rare that you actually see them being used to be honest, i cant recall ever using doevent to be honest.

But Try both see which works better for you and let us know, that way anyone this particular problem up over the search might be able to get it a bit more indepth and a better insight.

Kind Regards
Devon.
Mar 30 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
8247
by: Yogi_Bear_79 | last post by:
Self Taught here so please bear with me. I have the labelRestrictSites as private on the MainForm.cs. I then access the labelRestrictSites.Text thru the public string LabelRestrictSites from another class. So when I add labelRestrictSites.refresh code to my class I get an error because the labelRestrictSites is private. How would I refresh? ****************************************
1
9237
by: nospamjac | last post by:
Hi, Is there a way to update the text of an asp:label on a webform without refreshing the entire page? What is called by button clicks and other events that refresh a webform control? See the example WebForm1.aspx and WebForm1.aspx.cs code below: WebForm1.aspx =======================================================
4
326
by: Ed Willis | last post by:
If I am processing through a loop in my code and I want to update a row count on the window, how can I make the window refresh and show the label etc. updating? Thanks.
6
3166
by: jcrouse | last post by:
I am rotating some text is some label controls. In the one place I use it it works fine. In the other place I use it I can't figure out the syntax. I don't really understand the event. Where it works fine, it seems to fire when the form changes visibility. Here is the code. Private Sub lblP1JoyUp_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles lblP1JoyUp.Paint If lblP1JoyUp.Visible = True Then Dim...
2
399
by: Ned Balzer | last post by:
Hi, Apologies if this is a newbie question, I haven't found the answer in any faqs. I have an asp.net 2.0 page that sets session variables and then redirects to another page. For the page that gets redirected to, I've swapped in a simple page for testing that reads the session variables and displays their values.
3
6293
by: KenMacksey | last post by:
Hi I am running VB6 on a pentium 4 and Win XP pro. I wrote a small program to copy files to a memory card or mp3 player etc in a specific order or a random order instead of the windows default alphabetical order. Because the files take about 1 second to be copied, if there are 150 files, it takes about 150 seconds to copy them all. During this time, it appears as if nothing is happening, so I use a label that is constantly updated and...
2
2605
by: =?Utf-8?B?Y2FzaGRlc2ttYWM=?= | last post by:
Hi, I have a Label on a Windows form (Version 1.1.4322) and while I iterate recursively through a method I want to show the name of the current file being copied to another directory. The Label is not visible until the backup begins, at which point I resize the form to show the Label and a ProgressBar. As each file is copied, the Label is updated:
0
5524
by: Phillip Ian | last post by:
Tried this over in CSharp.General and didn't get anything, so I thought I'd try again here. If there's an AJAX specific group I could ask this in, please let me know...I did look. I'm trying to code what I think is a fairly typical Master/Detail scenario with two GridViews, using AJAX. Using the Northwind sample, I have two ObjectDataSources - one which pulls data from the Orders table, and one that pulls the related data from . Each...
4
1663
by: =?Utf-8?B?YmJkb2J1ZGR5?= | last post by:
I have a couple of questions, these are problems that I have experienced with IE 6 1. I have a label on a form, and sometimes when the form refreshes the label doesn't appear on the screen, however when I hide the form and then reshow it the label appears. So I was wondering how to refresh the form so I don't have to hide and show to see the label. 2. I have another form that has a drop down list, button and a label and it scrolls....
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10588
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.