Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8248333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:09:29+00:00 2026-06-07T23:09:29+00:00

public void Save(string path , string fileName , PictureBox pb) { int framesNumberX =

  • 0
public void Save(string path , string fileName , PictureBox pb)                
{
    int framesNumberX = 0;
    int framesNumberY = 0;
    string fn;
    string t = Path.GetFileNameWithoutExtension(this.name);
    if (File.Exists(path + "\\" + "DATABASE" + "\\" + fileName + "\\" + t + ".txt"))
    {
        try
        {
            string f = Path.Combine(path + "\\" + "DATABASE" + "\\" + t + "\\" + fileName);
            File.Delete(f);
        }
        catch (Exception ex)
        {
            MessageBox.Show("Error: Could not delete file from disk. Original error: " + ex.Message);
        } 
        fn = path + "\\" + "DATABASE" + "\\" + t + "\\" + fileName;
    }
    else
    {
        fn = path + "\\" + "DATABASE" + "\\" + fileName + "\\" + this.name + ".txt";
    }
    OptionsFile setting_file = new OptionsFile(fn);
    setting_file.SetKey("File Name", fn);
    setting_file.SetKey("Object Name", fileName);
    setting_file.SetKey("Animation Name", this.name);
    setting_file.SetKey("picturebox.Width", pb.Width.ToString());
    setting_file.SetKey("picturebox.Height", pb.Height.ToString());
    string[] xFrames = new string[wocl.Count];
    string[] yFrames = new string[wocl.Count];
    string X="";
    string Y="";
    for (int i = 0; i < wocl.Count; i++)
    {
        X  = string.Format("Frame_X_{0} ", i + 1);
        Y  = string.Format("Frame_Y_{0} ", i + 1);
        int c = Convert.ToInt32(X);
        int d = Convert.ToInt32(Y);
        framesNumberX += c;
        framesNumberY += d;
        for (int j = 0; j < wocl[i].Point_X.Count; j++)
        {
            xFrames[i] += string.Format("{0},", wocl[i].Point_X[j]);
            yFrames[i] += string.Format("{0},", wocl[i].Point_Y[j]);   
        }    
        string tt = xFrames[i].Trim(",".ToCharArray());
        string yy =  yFrames[i].Trim(",".ToCharArray());
        setting_file.SetKey(X, tt);
        setting_file.SetKey(Y, yy);
    }    
    setting_file.SetKey("Number Of Frames X", framesNumberX.ToString());                
}

If im doing in the loop for example : FrameNumber +=; it will count me the number of frames for example 6. But i want to count how many times the frames of X showed up and how many frames of Y.

I tried ot it like this:

X  = string.Format("Frame_X_{0} ", i + 1);
Y  = string.Format("Frame_Y_{0} ", i + 1);
int c = Convert.ToInt32(X);
int d = Convert.ToInt32(Y);
framesNumberX += c;
framesNumberY += d;

But thats not working not a good way.

Maybe i need to make the counting of X and Y in the end after the variables tt and yy ?
I want to count how many times the loop did the variable tt and how many times it did the variable yy. Just puting int variable and make ++ will give me the overall frames i need to seperate them to X and Y. So if i have for example 6 frames so X will be 3 and Y will be 3.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T23:09:32+00:00Added an answer on June 7, 2026 at 11:09 pm

    EDIT

    for this code to work

      X  = string.Format("Frame_X_{0} ", i + 1);
      Y  = string.Format("Frame_Y_{0} ", i + 1);
      int c = Convert.ToInt32(ExtractNumbers(X));//modfied code line
      int d = Convert.ToInt32(ExtractNumbers(Y));//modfied code line
      framesNumberX += c;  framesNumberY += d;
    

    you need to extract number something like this

    static string ExtractNumbers( string expr )
    {
     return string.Join( null,System.Text.RegularExpressions.Regex.Split( expr, "[^\\d]" ) );
    }
    

    Prev Ans

    Good way to do is

    static void Main()
        {
        // Convert string to number.
        string text = "123";
        int num = -1;
          if( int.TryParse (text,out num))
        Console.WriteLine(num);
        }
    

    check that string is convertable or not

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public void SaveJpeg(string path, Image image, int quality) { //ensure the quality is within
public void Save() { XmlSerializer Serializer = new XmlSerializer(typeof(DatabaseInformation)); /* A first chance exception
I have problem with ObjectContext.SaveChanges method: public void Save(Action<object, object> action) { EventAggregator.GetEvent<EntityServiceRequestingEvent>().Publish(true); var
@Service @Repository @Transactional public class VideoService { @PersistenceContext EntityManager entityManager; public void save(Video video)
I'm using the EntityManager to persist data into my database. public void save(X x){
public void openOptions() { Intent intent=new Intent(this,Game.class); //intent.putExtra(razmer, level); startActivity(intent); // Intent intent=new Intent(this,Options.class);
i want to save and retrieve image path in my application this is my
I am getting this exception when trying to save a file: System.Web.HttpException: The SaveAs
I have an camera Activity like this: public void startCamera() { Log.d(ANDRO_CAMERA, Starting camera
public void init() { String download = getParameter(update); String home = System.getProperty(user.home); String saveTo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.