Mike Askew 131 Veteran Poster Featured Poster

That would create an array of 'Grades'

Edit: Completely mis-understood the last bit, its covered in bleedi's post below

Mike Askew 131 Veteran Poster Featured Poster
int[] TheArray = new int[20]; //Declaring TheArray to hold 20 objects

//Adding to TheArray
TheArray[0] = 5; //Arrays always start at 0, so 0-19 in this case.
TheArray[1] = 10;
TheArray[2] = 15;

//Reading from the first entry in TheArray
Console.WriteLine(TheArray[0]);

//Reading from all of TheArray
foreach(int in TheArray)
{
    Console.WriteLine(int);
}

Hope that explains it simply :)

Mike Askew 131 Veteran Poster Featured Poster

I could be completely wrong here as not tried any of code only looked at it,

But shouldn't ((CheckBox)row.FindControl("chkTypes")).Checked;

Be (CheckBox)(row.FindControl("chkTypes")).Checked;

So that is casts the object found as a CheckBox and not the row?

Mike Askew 131 Veteran Poster Featured Poster

Quick google turned this up, perhaps it is what your looking for?

Mike Askew 131 Veteran Poster Featured Poster

ChrisHunter is right here, we cannot provide help to a problem which we cannot even see let alone understand. If you give us the input (you have) and the output desired (lacking) we can find the solution.

Mike Askew 131 Veteran Poster Featured Poster

You can use the same DLL's as in the windows forms with the web based solution :)

If i remember rightly (not used in about 5 months) its simply a matter of referncing the DLL's and you can use their contents within the c# side of the webpages, therefore allowing use of their methods like in the winforms version :)

Mike Askew 131 Veteran Poster Featured Poster

@riahc3, I assume your on about this:

foreach (c in contact.Nodes()) {
   Console.WriteLine(c);
}

In which case c is the local variable name used inside the foreach representing a node in contact.Node object.

Assuming c stands for contact in this case.

Mike Askew 131 Veteran Poster Featured Poster

Could try a message box displaying a datetime down to milliseconds to see which executes first? Should be a slightly noticeable difference in the millisecond portion of the time?

Mike Askew 131 Veteran Poster Featured Poster

Edit: Mitja Bonca beat me to it!

An alternate way to carry out ChrisHunter's suggestion, including handling for non-numeric input would be a TryParse.

    int guessedNumber;
    bool parseSucceeded = Int32.TryParse(textBox1.Text, guessedNumber);

This will set the bool parseSucceeded to true if the text in textBox1.Text was numeric and could be converted, else the result will be false and you can take action on this value with a loop or something similar.

See here for the MSDN Article on this method.

Mike Askew 131 Veteran Poster Featured Poster

text inside a CDATA section will be ignored by the parser.

w3schools quote.

You will have to have the data another way or manipulate it externally to XSLT as in the CDATA section if simply wont even be looked at

Mike Askew 131 Veteran Poster Featured Poster

A quick google found this.

Link

Mike Askew 131 Veteran Poster Featured Poster

Could you put the CDATA credit card number value into a variable and then use that instead of trying to read the node?

Mike Askew 131 Veteran Poster Featured Poster

Tried forcing the application to run as an administrator?

Mike Askew 131 Veteran Poster Featured Poster

Could you explain the 2nd post as your "output" code is the same as input with the namespace declaration shown twice.

Which namespace (if any) are your nodes in? Im assuming none in which case will get back to you with the XSLT shortly.

My XSLT:

<xsl:stylesheet version="1.0"
  xmlns:x="http://something.com"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xsi="http://differentNS.com"
  exclude-result-prefixes="xsi xsl" >

  <xsl:output method="text" omit-xml-declaration="yes" indent="no"/>

  <xsl:template match="text()">
    <xsl:apply-templates select="x:TestXML"/>
  </xsl:template>

  <xsl:template match ="x:TestXML">
    <xsl:variable name="GlobalID">
      <xsl:value-of select="x:ForAll/x:GlobalID"/>
    </xsl:variable>
    <xsl:variable name="OriginatingLoc">
      <xsl:value-of select="x:ForAll/x:OriginatingLoc"/>
    </xsl:variable>

    <xsl:for-each select="x:Order">
      <xsl:value-of select="$GlobalID"/>
      <xsl:value-of select="$OriginatingLoc"/>
      <xsl:value-of select="x:Customer/x:Name"/>
      <xsl:value-of select="x:Customer/x:Gender"/>
      <xsl:text>&#0010;</xsl:text>
      <xsl:value-of select="x:Customer/x:DOB"/>
      <xsl:text>&#0010;</xsl:text>
      <xsl:value-of select="x:Address/x:Street"/>
      <xsl:value-of select="x:Address/x:City"/>
      <xsl:value-of select="x:Address/x:State"/>
      <xsl:text>&#0010;</xsl:text>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

Produces the output you stated in the first post.

Hope it helps.

Mike Askew 131 Veteran Poster Featured Poster

Hi Trady,

I got the result layout you wanted using the following XSLT stylesheet:

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  xmlns:cs="urn:cs"
  exclude-result-prefixes="cs msxsl" >

  <xsl:output method="text" omit-xml-declaration="yes" indent="no"/>

  <xsl:template match="order">
    <xsl:apply-templates select="workflows"/>
  </xsl:template>

  <xsl:template match="workflows">
    <xsl:for-each select="workflow/items/orderitem">
      <xsl:value-of select="@id"/>
      <xsl:text>&#32;</xsl:text>
      <xsl:for-each select="jobs/job">
        <xsl:value-of select="@id"/>
        <xsl:text>&#32;</xsl:text>
      </xsl:for-each>
      <xsl:text>&#0010;</xsl:text>
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>

Hope this helps :)

Mike Askew 131 Veteran Poster Featured Poster

Research has corrected my aim, Im after the windows server roles not IIS roles, should have looked at the setup on server sooner lol.

Mike Askew 131 Veteran Poster Featured Poster

Does anyone know if this is possible and if so how I would go about it, as it has currently got me stumped completely!

Thanks in Advance,

Mike

Mike Askew 131 Veteran Poster Featured Poster

Problem has been solved. It was an issue to do with the namespace the XML used (wasnt aware this had an impact due to inexperience with XSL)

:)

Mike Askew 131 Veteran Poster Featured Poster

I cannot post the actual XML due to what it is used for however I will quickly recreate the structure of the document.

<T>
 <A>
  <B>
   <1></1>
   <2></2>
  </B>
  <C>
   <1></1>
   <2></2>
  </C>
 </A>
 <D>
  <E>Data</E>
  <TestNode>Data</TestNode>
 </D>
</T>
Mike Askew 131 Veteran Poster Featured Poster

Firstly I will say im a complete and total novice when it comes to XSLT and XML so this could be a very obvious mistake on my behalf.

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="node()">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="TestNode">
    <RenamedNode>
      <xsl:copy-of select="."/>
    </RenamedNode>
  </xsl:template>

</xsl:stylesheet>

When running the above, even though <TestNode> exists it does not match and rename the node and I cannot figure out why :/

Is anyone able to shed some light on why this is the case?

Thanks in advance

Mike Askew 131 Veteran Poster Featured Poster

It is :) sadly i've not got round to learning how to use it properly yet lol, still in the land of standard winforms!

Mike Askew 131 Veteran Poster Featured Poster

Skata is right, look into WPF for decent UI's :)

Mike Askew 131 Veteran Poster Featured Poster

Just wondering if it is possible to see the applications running within ApplicationPools on IIS7.

Im able to access all the pools and see their settings yet cant seem to work out how to see what applications are running in each :(

Regards,

Mike Askew 131 Veteran Poster Featured Poster

Could try running it with a sleep of (500), equivalent of half a second.


Thread.Sleep() Is safe as it literally pauses execution of the thread and so therefore just makes the computer wait before running your next line of code, might give it the time to close the connection properly though in personal experience i've never had your issue.

Mike Askew 131 Veteran Poster Featured Poster
Mike Askew 131 Veteran Poster Featured Poster

Hehe fair enough, thanks for the input lads :) Now to spend hours trawling tutorials!

Mike Askew 131 Veteran Poster Featured Poster

Hmm interesting :) was half expecting either XSLT or XPath as those are what the guys at work are suggesting looking into.

Personally im already hating XML :D

Mike Askew 131 Veteran Poster Featured Poster

I currently need to be able to read through an XML document, find certain nodes and either delete them (and child nodes) or edit the nodes name and possibly value. What would be the best way of going about this?

XPath?
XSLT?
XMLReader/XMLWriter?

My Code/XML contents cannot be posted though.

Mike Askew 131 Veteran Poster Featured Poster

Sorry for the delayed reply, that has worked perfectly thanks, problem solved :)

Mike Askew 131 Veteran Poster Featured Poster

Thank you Skata, I will look at this over the weekend and come back to you :)

Mike Askew 131 Veteran Poster Featured Poster

Hi all,

I am looking to have a long process running in the background to my main form with a timer ticking on the main form animating the elipsis on the end of some text.

Was looking for some insight into the best way to go about this and any decent resources worth reading on the subject, or a starter.

Im aware of the BackgroundWorker class so im assuming this will be used but implementation is where im falling down.

Cheers,

Mike Askew 131 Veteran Poster Featured Poster

@Jigz: Capital L; Little l. I do know how to spell the word and am not silly :)

@Momer: whats diff between "xxx" = "xxx" and StrComp('xxx','xxx')? Apart from one would be a bool and one an int?

Mike Askew 131 Veteran Poster Featured Poster

Assuming my clarification was correct the following console app will show you that the code above I gave does indeed work :)

class Program
    {
        static void Main(string[] args)
        {
            List<int> Numbers = new List<int>() { 15, 10, 5 };

            Console.WriteLine("Original numbers:");
            Console.WriteLine();

            //The code to print numbers and then decrement/update list.
            for (int x = 0; x < Numbers.Count; x++)
            {
                Console.WriteLine(Numbers[x]);
                Numbers[x] -= 1;
            }

            //Spacing because i like formatting on console apps
            Console.WriteLine();
            Console.WriteLine("New decremented list values");
            Console.WriteLine();

            //Just used to check the decrement worked.
            for (int x = 0; x < Numbers.Count; x++)
            {
                Console.WriteLine(Numbers[x]);
            }

            Console.ReadLine();
        }
    }
Mike Askew 131 Veteran Poster Featured Poster

Right so let me understand,

You have one list containing for example 15, 10, 5.

You wish to decrement those values by 1.

You finally wish to overwrtie the old list so it now contains 14, 9, 4?

Just to clarify before I try code it :)

Mike Askew 131 Veteran Poster Featured Poster
for (int i = 0; i < sample.Count; i++)
            {
                Console.WriteLine(sample[i]);
                sample[i] -= 1; //This line is shorthand for sample[i] = sample[i] - 1
            }

That should do the trick :)

Mike Askew 131 Veteran Poster Featured Poster

It should do, i also tested this in visual studio to check if HeLlO matched Hello and it did not, you may wish to check your login validation code itself and not the mismatch of case sensitivity :)

Mike Askew 131 Veteran Poster Featured Poster
MessageBox.Show("MessageGoesHere");

This, when running a windows forms application, will display a popup message box on screen displaying the information you have passed it within the brackets.

return x;

Return is used to send a variable back from a method to the block of code that called the method. It is a required line of code for methods that are not declared as void (returns nothing)

For example:

int a = 10;
int b = 5;

int d = Addition(a, b);

public int Addition(int Num1, int Num2) //Method returning a parameter of type Integer
{
    int c = Num1 + Num2;
    return c;
}

In the above example we have two integers, a and b, which I am passing to a simple addition method that will add them together and give me back a value to set integer d too.

In this method the return keyword plays the role of passing the value of 'c' back to the original location the method was called from, in this case line 4.

Mike Askew 131 Veteran Poster Featured Poster

Kk lemme know, sorry wasnt of more use

Mike Askew 131 Veteran Poster Featured Poster

It is strange indeed, calling the .Dispose() method is the garbage cleaner for the two variables we call it on so it should work. Stumps me at this point tbh.

Yeah could give it a shot using a .txt though you can also open and edit csv's in notepad :P?

Mike Askew 131 Veteran Poster Featured Poster
private void RowCount()
      {
         DataTable ConfDT = new DataTable();
         string tempPath = @"C:\Download Report Sheets\";
         string strConn = @"Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + tempPath + @"\;Extensions=asc,csv,tab,txt";
         OdbcConnection conn = new OdbcConnection(strConn);
         OdbcDataAdapter da = new OdbcDataAdapter("Select * from Releases.csv", conn);//TestFile
         conn.Open();
         da.Fill(ConfDT);
         ConfigGrid.DataSource = ConfDT;
         ConfigGrid.Columns[0].DefaultCellStyle.Format = "G";
         conn.Close();
         da.Dispose(); //Try that
         conn.Dispose(); //Try that
      }

You may have already done it but try adding in the two lines at the bottom of the code block.

Technically im not sure why those are crashing as the variables would only live for the lifespan of the method anyway as they are local to it.

The error itself points to the file your trying to open already being open by something else or not closing quick enough within your program. How many times is the program executing this per second?

Mike Askew 131 Veteran Poster Featured Poster

As its not running in an AJAX panel from what I can see, would the page also need a postback to apply the colour change? Admittedly I lack experience within ASP.Net but that would be my first idea :)

Mike Askew 131 Veteran Poster Featured Poster

What do you mean by set case sensitivity?

If you are comparing within c# the strings that you pull from the password field of the database will be compared case sensitive by default.

Mike Askew 131 Veteran Poster Featured Poster

Again not being written in an IDE but still.

Could you not do something like the following:

Console.Writeline("\t Job Name \t Job Size \t Time")
For (int i = 0; i < container.Count; i++)
{
    String.Format("{0}. \t {1} \t {2} \t {3}", (i+1), jobname[i], job[i], time[i]);
}

This code uses a string formatter to put the values into each line of the string, they are spaced [hopefully] evenly using the [TAB] char "\t" however you may need to fine tune the tabbing.

Hope that helps.

Mike Askew 131 Veteran Poster Featured Poster

As a matter of good practice I would manually dispose of the elements after each use, not relying on a garbage collection then and should hopefully resolve the error.

Mike Askew 131 Veteran Poster Featured Poster

Kind of impossible to tell from the information provided.

Common sense would say either the Baza.Schedule object doesnt contain anything row wise or there is a failing link in your database working somewhere preventing the rows being pulled?

Maybe give us a more extensive code post and an insight into the type of informaation that you should be expecting?

Mike Askew 131 Veteran Poster Featured Poster

Yeah i had a feeling the ! might error as i wrote it on the fly on here not in visual studio :D would of just had to add an extra set of brackets around the whole expression to apply the ! too :)

Any other issues?

Mike Askew 131 Veteran Poster Featured Poster

Forgive me if im wrong for arguing though, if you made your label span from one side of the form to the other, and did text align center, the text (regardless of length) will always sit within the center or the form.

From what your saying thats the simplest way to gain your outcome. Unless your wanting something else and im misunderstanding in which case clarify further.

Mike Askew 131 Veteran Poster Featured Poster

Fair do's shall do :)

Mike Askew 131 Veteran Poster Featured Poster

Just a quick suggestion but it would be useful to be able to filter down all the threads in a section to the ones you have replied too, using the tabs at the top.

As there is definately space for another tab :D

Implementing it could not be so easy though, not sure how it would work ;)

Other than that this site is most definately my cure for a lack of work atm! :D

Regards,

Mike

Mike Askew 131 Veteran Poster Featured Poster

Could try something like:

while (totality <= 50000)
            {
                if (!(totality + job[i]) >= 50000)
                    totality = totality + job[i];
                i++;
            }