Convert String to Imagename

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gangste85™
    New Member
    • Mar 2008
    • 2

    Convert String to Imagename

    Hello,

    i am having a C# convert problem. I am using a XML to save positions of all the items on screen so you can customize.
    I am having a image right now. Its Called Image1.
    I have a string and a int.

    If i use
    Image1.Height = int;

    the image will be change to the int value.
    Now i have a string with the value Image1, if i use
    string.Height = int;

    I am getting the error that a string doesn't have a Height, thats normal,
    But i need to know how to parse the string into the imagename, can anyone help, i have tried google, but most is garbage there...
  • saran23
    New Member
    • Mar 2008
    • 28

    #2
    Originally posted by gangste85™
    Hello,

    i am having a C# convert problem. I am using a XML to save positions of all the items on screen so you can customize.
    I am having a image right now. Its Called Image1.
    I have a string and a int.

    If i use
    Image1.Height = int;

    the image will be change to the int value.
    Now i have a string with the value Image1, if i use
    string.Height = int;

    I am getting the error that a string doesn't have a Height, thats normal,
    But i need to know how to parse the string into the imagename, can anyone help, i have tried google, but most is garbage there...
    If Ur using the name of the image as string,it wont hav the height property,
    try this create a image at run time, name it with the string value, and set the height.

    If ur some more clear it will be easy to help u correctly.

    Comment

    • gangste85™
      New Member
      • Mar 2008
      • 2

      #3
      I have declared a image.

      <Grid>
      <Image Height="60" Width="40" Margin="10,10,0 ,0" Name="image1" VerticalAlignme nt="Top" HorizontalAlign ment="Left" Stretch="Fill" Source="/BackEnd_Demo_1; component/c_virginmary4.g if" Grid.Row="1" />
      </Grid>

      In a XML file i have two value's 20 and image1

      I am getting thes value's and parsed 20 in to an int and image1 into a string
      if i have the following code

      image1.Height = int;

      It change the height om image1, but i want to
      use the string to say with image it is such as

      string.Height = int;

      but i nee to know how to parse a string to a ImageName..

      am i clear...

      Comment

      • saran23
        New Member
        • Mar 2008
        • 28

        #4
        Originally posted by gangste85™
        I have declared a image.

        <Grid>
        <Image Height="60" Width="40" Margin="10,10,0 ,0" Name="image1" VerticalAlignme nt="Top" HorizontalAlign ment="Left" Stretch="Fill" Source="/BackEnd_Demo_1; component/c_virginmary4.g if" Grid.Row="1" />
        </Grid>

        In a XML file i have two value's 20 and image1

        I am getting thes value's and parsed 20 in to an int and image1 into a string
        if i have the following code

        image1.Height = int;

        It change the height om image1, but i want to
        use the string to say with image it is such as

        string.Height = int;

        but i nee to know how to parse a string to a ImageName..

        am i clear...
        Hi,
        Im not sure how to implement this, but try this,
        1.Create a image at run time,
        2.set the string to the ID of the image,
        3.now set the height property,

        hope this works, ur image will have the name of the string value, and u can set the height too...

        Comment

        Working...