Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
dear all
using this code , if i drag scroll bar images appear till end , but it get stuck at end
please help me out
nitin
C#
private void vScrollBar1_ValueChanged(object sender, EventArgs e)
{
    if (icount < objclsvrb.objds.Tables[0].Rows.Count)  
    {
        if (icount == 0)          
        {
            axDicomViewer1.Images.ReadFile("D:/FilmPlus_MSAccess/bin/Debug/Images/" + objclsvrb.objds.Tables[0].Rows[icount][0].ToString() + ".dcm");

            icount++;
        }
        else
        {
            axDicomViewer1.Images.ReadFile("D:/FilmPlus_MSAccess/bin/Debug/Images/" + objclsvrb.objds.Tables[0].Rows[icount][0].ToString() + ".dcm");

            icount++;
        }
    }
    else
    {
        MessageBox.Show("not found");
            
        vScrollBar1.Value = 0;
    }
}
Posted
Updated 27-Aug-12 22:15pm
v2
Comments
lukeer 28-Aug-12 4:18am    
Use the "Improve question" link to provide further information:

What is icount?
What do you expect to happen?
What does actually happen?
Do you get any error messages? Post them.
Member 8893861 5-Sep-12 3:15am    
icount is integer for for loop
if i scroll down viewer should display image one after another
but if i scroll down scroll down and scroll up is not working sequentially ,
for example if i have 4 images a1 a2 a3 a4 ,viewer should show first a1 and lastly a4 ,and at mouse upward first a4 and lastly a1 .but it does not , while upowrd it takes a3 a2 a1 a4.
No error message

you haven't decremented 'icount' for condition when scroll move reverse
for that declare a page-level variable & maintain previousValue of scrollbar.
compare it with current-value if currentvalue is less than previous then
code for icount--
Happy Coding!
:)
 
Share this answer
 
some changes I made
int icount=1;

C#
private void vScrollBar1_ValueChanged(object sender, EventArgs e)
       {
           
           sbvalue = vScrollBar1.Value;

           vScrollBar1.Maximum = num ;
  


           if (icount < objclsvrb.objds.Tables[0].Rows.Count)  //
           {

               if (icount == 0)          
               {
                   axDicomViewer1.Images.ReadFile("D:/FilmPlus_MSAccess/bin/Debug/Images/" + objclsvrb.objds.Tables[0].Rows[icount][0].ToString() + ".dcm");

                   icount++;
               }
               else
               {
                   axDicomViewer1.Images.ReadFile("D:/FilmPlus_MSAccess/bin/Debug/Images/" + objclsvrb.objds.Tables[0].Rows[icount][0].ToString() + ".dcm");

                   icount++;
                

               }
           }

           else
           {
               //MessageBox.Show("not found");
               icount = 0;
               vScrollBar1.Value = 1;
           }
       }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900