nmaillet 97 Posting Whiz in Training

In C++, an unimplemented default constructor does nothing. If you declare and implement the default constructor, you can:

class CheckGarbage
{
private:
    int rollNo;
    float cgpa;
    char* name;
public:
    CheckGarbage()
    {
        rollNo = 0;
        cgpa = 0;
        name = NULL;
    }
    void checkValue()
    {
        cout<<"Roll no : " <<rollNo <<endl;
        cout<<"CGPA : " <<cgpa <<endl;
        cout<<"name : " <<name <<endl;
    }
};

There isn't really an idea of a default value for particular data types in C++, like in some other langauges. What you may be actually referring to, is the default value of a parameter, like so:

CheckGarbage(int r = 0, float c = 0, n = NULL)
{
    rollNo = r;
    cgpa = c;
    name = n;
}

You can read more on them here or here. A constructor with default values for all parameters, takes on the role of the default constructor.

nmaillet 97 Posting Whiz in Training

You shouldn't use Wikipedia to back up and argument or in research, it can be edited by anyone so it's unreliable.

You seem to have forgotten to post your sources... Your post can be edited by you, so how else am I going to know if it's reliable?

ChrisHunter commented: Touché +4
nmaillet 97 Posting Whiz in Training

Just an FYI in response to darkagn (and anyone else who reads this thread later). According to Wikipedia, the versions of Mono do not follow the C# version (which also doesn't necessarily follow the .NET Framework version).

Mono 3.0 implements C# 5.0 which runs on .NET Framework 4.5.

nmaillet 97 Posting Whiz in Training

I guess what I'm getting at, is that you stated it as fact (maybe not intended) that they are the best. Reviews are incredibly subjective, because people are subjective and will always have some bias. Here's some user reviews from the second link of a Google search for "godaddy reviews": http://www.whoishostingthis.com/hosting-reviews/go-daddy/. Some people weren't too happy with their hosting, so it would look like GoDaddy is not the best, in their opinion.

Also, read this review again: http://web-hosting-review.toptenreviews.com/godaddy-review.html and use its "Compare" feature. GoDaddy only came in at number 1 in ease of use (tied with 2 others). How could the best have fallen behind others in some areas?

EDIT: In fact, according to that review (that you posted) justhot.com is better: http://web-hosting-review.toptenreviews.com/. It beat or tied GoDaddy in every category.

nmaillet 97 Posting Whiz in Training

Might I recommond a read-through of: User Input Validation in Windows Forms. Also, Google "winforms validation"; you'll find some decent tutorials.

There are a few issues I have with Begginnerdev's suggestion:

  1. Not focusing on the textbox, bypasses the validation (eg. click an OK button before clicking the textbox). There are work-arounds, but aren't very scaleable.
  2. The user gets trapped until they enter a valid value. This is mostly personal preference, and not always a big issue.
  3. Message boxes for every invalid value can be a pain to the user. Again, personal preference, but a consideration.

I could go on, and have been in a few debates over this, but I want to point out that it isn't necessarily bad design. It comes down to personal preference in some sense, but I prefer other solutions that are more scalable and I think the user will be happier with.

Begginnerdev commented: True, but this was only for proof of concept. = ) +7
nmaillet 97 Posting Whiz in Training

MonoDevelop is a free cross-platform IDE for .NET langauges. It can build applications for Mono, which is a cross-platform implementation of the .NET Framework (I believe it can also target .NET, which would support Windows only).

I haven't used it in years, but it seemed pretty good then.

nmaillet 97 Posting Whiz in Training

Using Add Service Reference... in the project's context menu, allows you to add a local WSDL file. Visual Studio can then generate the necessary classes, and you can specifiy the URL to use like so:

new MyServiceClient("config", "remoteAddress");

Where you would replace "config" and "remoteAddress" with the appropriate config and URL respectively (or specify the remote URL in the config).

Unless there's something I'm not getting about your question...

mradzinski006 commented: Correct answer +0
nmaillet 97 Posting Whiz in Training

It's not a stupid question; asking questions is a great way to learn. A BackgroundWorker creates and manages a Thread for you, and provides a few convenient features. So I'll try and give a quick explanation of how a BackgroundWorker works.

First the BackgoundWorker creates a Thread and executes the DoWork event. So everything you do in the DoWork event handler, is executed on a separate thread from the UI thread. From this Thread, you cannot access or interact with any UI components (i.e. you can't update TextBox's, ProgressBar's, etc.). One of the great features of the BackgroundWorker is the ReportProgress() method and the ProgressChanged event. You can call the ReportProgress() method like so:

private void bw_DoWork(object sender, DoWorkEventArgs args)
{
    BackgroundWorker bw = sender as BackgroundWorker;
    ...
    bw.ReportProgress(1);
    ...
}

This causes the "DoWork" thread to block (not execute) while the ProgressChanged event is executed. The event handler for this event is called on the UI thread, so it allows you to update a UI component (such as a ProgressBar). Note that ReportProgres() can also support an Object so you can pass a lot of information to the event handler. Finally, the RunWorkerCompleted event handler is called on the UI thread (when DoWork is done) allowing you to update the UI when it completes.

Hope that helps. Let me know if you have any more questions/need clarification.

nmaillet 97 Posting Whiz in Training

Are you talking about a graphics.h header? As far as I know, most people have stopped using these in favour of some more advanced/modern OS libraries. Take a look at this.

As for making it bootable, I would get a Linux distro and modify it to boot your program.

nmaillet 97 Posting Whiz in Training

Giving explicit directions to completing a project is not something you're going to get on this forum. If you want some help, show some initiative (and some code) and explain where you are having issues. If you don't know the language, then starting Googling for some C# tutotials.

nmaillet 97 Posting Whiz in Training

Show the code you need help with. We won't "help" by giving you the code.

nmaillet 97 Posting Whiz in Training

int random = (int)(Math.random() * (41) - 20 );

Note quite, reread my post. You have to cast it to an int while the number is still positive (move a parenthesis, hint hint).

if(random >= 0) ...
if(random < 0) ...

While this does work, it is good practice to use an else block in this case, like so:

if(random >= 0) {
    ...
}
else {
    ...
}

sumNegativeNum -= random;

This would give you a positive results (since your negating a negative number). You'd probably want to keep this negative like so:

sumNegativeNum += random;

Other then those few small things, it looks like you're on track.

nmaillet 97 Posting Whiz in Training

I agree with Lucaci, but there's a couple things you need to be aware of. First, I wouldn't recommend using Math.random(), but you should of course use what the instructor tells you to. There is one problem however. From the Java API for Math.random():

Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.

This means that when you mutliply the random value by 40, it will never equal 40. It could be 39.99...; however, since casting to an int simply removes everything after the decimal, this will give you 39. So, to start we need to change it to:

int random = (int)(Math.random() * (41) + (-20) );

And let's get rid of the unnecessary parenthesis:

int random = (int)(Math.random() * 41 - 20);

This isn't the only problem though. Negative numbers cast to an int the same way, but this also means they round in the opposite direction than a positive number. For example, 5.8 rounds to 5 and -5.8 rounds to -5, both towards 0. This becomes a problem for the number -20, since the only way you can get this value is by getting exactly -20 (definately possible, but rare), where as -19 is possible for any value greater than -20 and less than or equal to -19. This creates a problem with the distribution, because not all of the numbers have the same probability. After all of that, there …

nmaillet 97 Posting Whiz in Training

You should create a Random class at the beginning of the method, instead of using the Math class. The Random class gives you the option to generate ints directly. nextInt(n) returns an integer in the range 0 (inclusive) and n (exclusive). So, in your case, you would need to use nextInt(41), then adjust for the range -20 through +20. You should also try and do everything in one loop (it is possible to use a seed value to achieve the same random values in mutliple loops, but is inefficient and unnecessary). Then, initialize a few variables, such as:

a) countPos and countNeg
b) sumPos
etc.

Then use those variables after the loop to generate the required results. Give it a try, and let us know how you make out. If you run into any issues, please give an explanation of what isn't working correctly (i.e. what results you're getting vs. what results you expect).

nmaillet 97 Posting Whiz in Training

The class is public, but each instance variable can have an access modifier as well; see Dim Statement and Access Levels in Visual Basic for more info. When you don't explicitly give it an access modifier, it takes on a default access level (Private in this case); see Declaration and Contexts and Default Access Levels for more info on that. In short, you have to put Public in front of it, like so:

Public Class Form2
    Public Dim var1 As Integer
    ...
End Class

As a side note, Dim becomes optional when you use most keywords in a variable declaration, like this:

Public Class Form2
    Public var1 As Integer
    ...
End Class
nmaillet 97 Posting Whiz in Training

Nobody is going to do your work for you. Give it a try, show us some work and ask specific questions if you run into any issues, if you want any help.

AndreRet commented: Agreed!! +12
nmaillet 97 Posting Whiz in Training

Try this.

TnTinMN commented: :) +4
nmaillet 97 Posting Whiz in Training

Couple things:

  1. Titles that start with "PLEASE HELP ME" are annoying.
  2. Using all caps in bold for your post is even more annoying.

Now, as for your code. I don't understand what a "sequence" is supposed to be; it looks like your putting one result into a text box. Try explaining, in more detail, what exactly you are trying to do, and what your current code is doing wrong.

nmaillet 97 Posting Whiz in Training

K... did you try the SizeMode property...?

EDIT: Nvm, your welcome.

nmaillet 97 Posting Whiz in Training

What do you mean by "upload"? Assuming you want an image to stretch/zoom to fill the PictureBox, you can use the PictureBox.SizeMode property.

nmaillet 97 Posting Whiz in Training

for i = 3 to i * i < number // start at 3 since 1 and 2 are prime

Shouldn't it be i * i <= number? Otherwise some square numbers will be improperly considered prime (e.g. 9 or 25).

nmaillet 97 Posting Whiz in Training

If you're using WinForms, you could use the MaskedTextBox control.

nmaillet 97 Posting Whiz in Training

You need a lock around Dequeue as well. Include The if statement too, since you wouldn't want the Count changing before the Dequeue.

nmaillet 97 Posting Whiz in Training

There's also the Leave event; it's fired when the TextBox loses focus. Just keep in mind, that if you have an AcceptButton set and the user presses <Enter>, the Button.Click event will fire, but the Leave event will not (since it never really loses focus).

You may want to even look at the validation logic that WinForms supports. You can individually validate each control in the Leave event, and also call ValidateChildren on the Form to validate all controls in the Button.Click event. Not sure if this applies in your situation, but just an idea.

nmaillet 97 Posting Whiz in Training

Haven't we already gone through this. Why are you using nested types? And why are you using structs? Structs are fine for a small number of variables, but as it grows, it starts taking up alot of valuable space on the stack. The heap is there for a reason, to hold large amounts of data. And in either case, string is still a class which allocates its character arrays on the heap. One common recommendation I keep hearing is that a struct should be 16 bytes or under. On most 32-bit architectures, and string is going to be a 4 byte pointer, that's 4 strings in a struct (2 on most 64-bit architectures).

nmaillet 97 Posting Whiz in Training

You could do it in the constructor:

public class Customer
{
    private readonly string Name;
    private readonly string Phone;

    private string Number;

    public Customer(string name, string phone)
    {
        if (string.IsNullOrEmpty(name))
            throw new ArgumentNullException("name");
        Name = name;
        ...
    }
}

FYI, the purpose of readonly is to prevent the value from being changed after the class is initialized (the value can only be changed in the constructor).

Also, the newcustomer() method is redundant, you should either have an method with no parameters, like so:

public void NewCustomer()
{
    ...
}

Or use a static method, like so:

public static void NewCustomer(Customer customer)
{
    ...
}

If you use it the way you currently have it, you would be able to reference two customers (possibly the same one) in the method, which is unnecessary and creates confussion for other developpers.

nmaillet 97 Posting Whiz in Training

No, that is a single thread. Do a Google search for thread tutorials, there are plenty out there. You generally use the Thread class, although there are others, such as the BackgroundWorker class. Here's a quick example that executes a Run() method on the main thread (the thread your program starts with) and a newly created thread:

using System;
using System.Threading;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            //Initializes a new thread that uses the Run() method.
            Thread thread2 = new Thread(Run);

            Console.WriteLine("Starting thread...");

            //Starts the new thread.
            thread2.Start("Thread 2");

            //Call Run() under the main thread.
            Run("Thread 1");

            //Waits for the second thread to finish executing.
            thread2.Join();

            Console.WriteLine("Done!");
            Console.ReadKey(true);
        }

        static void Run(object obj)
        {
            Random random = new Random();
            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine("{0}: {1}", obj, i);
                //Forces the thread to sleep for a random number of milliseconds (less than 500).
                Thread.Sleep(random.Next(500));
            }
        }
    }
}
nmaillet 97 Posting Whiz in Training

No, that example you gave shows nested classes, which is completely different from what we have been discussing. Let's simplify a bit, here's a class:

public class Customer
{
    public string str;
}

Here's an equivalent struct:

public struct Customer
{
    public string str;
}

They act the same (for the most part) and the differences are most obvious to developers from a C/C++ or some other low-level language background.

First, a struct is completely stored on the stack (you may want to read up on the stack and heap). A class is stored on the heap, and a pointer to the class object is stored on the stack. You generally want to avoid putting large amounts of data on the stack, as it is much more limited than the heap. That said, there are a lot of benifits when using a struct, but you really need to understand the difference before making that call.

There are quite a few differences other than where they are stored (most of which root from there location in memory) and that is all discussed in the referenced article.

nmaillet 97 Posting Whiz in Training

You are "printing" to two separate PrintStream objects (out and err). In your case, they both output to the same place (i.e. the console, or your IDE's output); however, they both use internal buffers that are dependant on the object. This is the same way files tend to work: data is not guaranteed to be writtern out when you call a print() method, it is stored in the buffer. At some point, data will be written out to the console, but it is handled automatically.

To test this out, try only using out (or err). This should give you the results you expect, as each print statement will be stored sequentially in the same buffer. In order to use out and err, and have them print in the correct order, you'll have to use the flush() method. This forces data in the buffer to be written out, like so:

class ThreeException extends Exception {
    private static final long serialVersionUID = 1L;
    static int count = 0;
    public static void main(String[] args) {
        while(true){
            try{
                if(count++ == 0)
                    throw new ThreeException();
                System.out.println("No Exception");     
                System.out.flush();
            } catch(ThreeException e){
                System.err.println("Three Exception");
                System.err.flush();
            } finally {
                System.err.println("In finally clause");
                System.err.flush();
                if(count == 2) break;
            }
        }
    }
}

This is done this way for performance reasons, and you generally want to avoid calling flush() (especially for files) until you are done with the particular stream, or (as in your circumstance) you want to guarantee data has been completely written to the underlying …

nmaillet 97 Posting Whiz in Training

but how can i use a single parameter i still need to write in all thoose from my windows forms? havnig a class for the customers is prob best but i will still need a function in that class similiar to what i already have?

You would start with a class like so:

public class Customer
{
    public string CustomerNumber;
    public string CustomerOrgNumber;
    ...
}

Your method would look something like this:

public void writeCustomer(Customer customer)
{
    ...
}

Then create, update and pass your customer data as a single parameter like this:

Customer customer = new Customer();
customer.CustomerNumber = "123-45";
customer.CustomerOrgNumber = "67-890";
...
writerCustomer(customer);

The example Customer class I gave is pretty simple, and you should probably use properties, add logic, etc.

nmaillet thank you! can you do that with functions that dont need a return value? because my function only needs the input not change anything ot give back

Yeah, it doesn't matter if there's a return type.

ddanbe commented: Well said! +14
nmaillet 97 Posting Whiz in Training

A struct wouldn't save any "memory", it would pretty well be equivalent. Depending on the architecture of your system and how the compiler wants to handle it, all data in a struct would be passed on the stack, so it would probably be better to use a class. A class would only require a pointer to be passed, while the class members would be allocated on the heap. FYI, passing a string only passes a pointer, not the entire character array.

Just so you are aware, optional parameter were implemented in C# 4.0 (that is, C# with .NET Framework 4.0). All optional parameters must follow all required parameters and requrie a default value (which can be null for ref types). For instance (not good practice, but shows how it's done):

int Sum(int a, int b, int c = 0, int d = 0)
{
    return a + b + c + d;
}

Then, optional parameters are determined by there order:

Sum(1, 2);       //a = 1, b = 2
Sum(1, 2, 3);    //a = 1, b = 2, c = 3
Sum(1, 2, 3, 4); //a = 1, b = 2, c = 3, d = 4

and you can explicitly reference an optional parameter:

Sum(1, 2, d: 4); //a = 1, b = 2, d = 4
nmaillet 97 Posting Whiz in Training

You'll probably have to use COM with Word, aka Word Interop; here's the reference. Note that this requires particular versions of Word to be installed on the client machines. I'm sure there are ways to determine and utilize the version at runtime, although I've never had the need to look into it.

You'll be able to load plain text pretty easily. If you want, you can get formatting information using the Interop libraries; however, it would be pretty near impossible to exactly match the formatting used by Word.

nmaillet 97 Posting Whiz in Training

A StackOverflowException is usually caused by recursive function calls. Try taking a look at the method(s) that instantiate a new instance of the Settings class (or post them here). There is probably something that calls the method again, or another method that ends up calling the method.

If your IDE shows gives you a call stack, post that too. I'm pretty sure Visual Studio won't, and since .NET 2.0, you can't catch it.

nmaillet 97 Posting Whiz in Training

Also keep in mind that local variables may not even take up space on the stack. Depending on the architecture, instruction set, compiler, etc., local variables may only exist in registers.

nmaillet 97 Posting Whiz in Training

Why limit yourself to 20? You could use either of these:

  • (<tab>){2,}
  • (<tab>(?:<tab>)+)

See the Quick Reference from the MSDN for more info. Both are simple ways to capture two or more tabs. Also, are you looking for the string "<tab>" or tab characters? You would use the character escape \t for tabs, and also note there's a \s to match all white-space characters should you be so inclined.

nmaillet 97 Posting Whiz in Training

You need a symbol to concatenate the "\Desktop\" and username. Also, you should be referencing the Text property of the TextBox username, not the TextBox itself.

Captain_Jack commented: Thanks +0
nmaillet 97 Posting Whiz in Training

Oh, why not:

int i;
clock_t ticks;

ticks = clock();
for(i = 0; i < 100000000; i++);
ticks = clock() - ticks;

printf("Number of ticks:   %ld\n", ticks);
printf("Clocks per second: %ld\n", CLOCKS_PER_SEC);
printf("Time ellapsed:     %ld ms\n", ticks * 1000 / CLOCKS_PER_SEC));
getchar();

Note, I did this with a C++ compiler, but it should work with a C compiler (don't have a C compiler to test it with). Also note that the order of operations in the last printf statement are very important. Reversing the 1000 and CLOCKS_PER_SEC would give me a result of 0ms instead of 235ms (in my case, where there were ticks=235 and CLOCK_PER_SEC=1000), since this is integer arithmetic.

nmaillet 97 Posting Whiz in Training

Access provides a file based database. This is quite different than an Oracle or SQL Server database. The latter have several processes which work as a middle-man between the client and the physical file(s). This would allow (I certainly should be possible, albeit I've never attempted it) the processes to see the updates to specific table, and notify connected clients (assuming the connections actually remain open). An Access database, on the other hand, has several processes (client applications) making changes directly to the file, and no real method of pushing a notification to any of the other processes.

As an aside, I've heard that you shouldn't use SQL Server Compact (another file based database) databases on network drives (if that's how you're currently doing it), as the file locking can be flakey, which could cause some concurrency issues. I don't know if Access has some method of overcoming this, but you should look into that.

So, you have a few options (non very ideal), other than moving to another database platform:

  • Write a custom server application as a wrapper for the database, that is able to manage the connections and push out notifications.
  • Poll the database for changes.
  • Have each client application connect to each other (or a central location, if possible) to push updates to each other. I wouldn't really recommend this though.

Unless anybody has some ideas, that's all I can think of. Good luck.

nmaillet 97 Posting Whiz in Training

Take a look at this. Basically, you'll want to use Double.toLongBits(f) or Double.toRawLongBits(f) (the difference between the two pertains to NaN values; see the documentation). These will give you a long integer, which you should be able to use Long.toHexString() to get the actual IEEE 754 value.

nmaillet 97 Posting Whiz in Training

You can give CG Textures a try. Their textures are free to use, with a few restrictions (see the license/FAQ).

As for "free" professional game engines, there are a few:

  • Unity: Free for the basic license, and $1500 for the Pro version. From what I here, it is one of the easiest to use.
  • UDK: Royalty based license, if you end up selling your game. This is built on the Unreal Engine 3 (used by many developers). It does lack some features from the full UE3 (such as native code, source code, etc.), but is quite full featured. It's interface could use some updating (and they seem to be getting there with UE4 demos, which should eventually make its way to the UDK). There are quite a few tutorials around for it.
  • CryENGINE 3 SDK: Similar license to the UDK. There isn't as much community support (yet) as Unity or UDK, from what I hear.

There's more out there, but these 3 stick out to me the most.

joycedaniels commented: Indeed But I think CG textures basically has textures for Maya and Max softwares. It won't be having like normal pics. Textures like skin or pebbles. +0
nmaillet 97 Posting Whiz in Training

The main purpose for method overloading is doing essentially the same thing with different types. Each method must have a unique "signature". The signature is made up of the number, order and type of the parameters (the return value doesn't matter).

In your sample program, you could call another one of the methods by casting one or both of the variables to an int:

area = Area((int)h, b);

The compiler will try to match the given parameters (based on their types) with the best method (closest signature to your input). It generally has to match exactly, but will perform implicit casts if necessary. In your program, the compiler sees that both input parameters are doubles, so it calls Area(double,double). If you took out that method, it would not call any of the other ones, since you cannot implicitly cast an int to a double.

nakor77 commented: simple and clear explanation +4
nmaillet 97 Posting Whiz in Training

I will start by saying that I'm not an experienced game developper, I've learned little bits and pieces when I find the time. In either case, you could take a look at these (you'll never get a definitive answer on which is best, its all subjective):

  • Unity: I have heard some good thing about Unity, although I haven't had the chance to try it out extensively yet. It does support C# scripting, but not VB.NET). It's free, except when you won't to go with the Pro version which is around $1500 I think.
  • UDK: The UDK is powered by the Unreal Engine 3. It lacks some features of the full UE3, like native code (you can use UnrealScript). It's free at first, but when you go to sell your game, you pay a license fee (around $100) plus a percentage of sales after $50,000.
  • CryENGINE 3: It is comparable, in terms of cost, to the UDK with some slight differences. I have heard some complaints about it, but could be worth a try.

I think the best advice I could give, is try out some different engines, see what other people have done, and pick the one you like the best. Unless you're planning on making a very high-end game, then it shouldn't matter too much which one you pick.

nmaillet 97 Posting Whiz in Training

The return value doesn't have to be stored. It is up to the programmer to determine what to do with a return value, or whether to not use it all together. In this case, the programmer decided to use an delegate to print the result and didn't need it for anything else in the Main method.

Hope that helps.

maurices5000 commented: Thanks! +0
nmaillet 97 Posting Whiz in Training

This should probably be in the WebDev section, but without seeing any examples, I don't think anyone be able (or atleast willing) to try helping. The layout and rendering of webpages is handled quite differently depending on the browser. That's one of the many reasons I've been avoiding any major web development projects.

nmaillet 97 Posting Whiz in Training

You'll need to install Visual Studio Tools for Office (VSTO), which may have been installed with Visual Studio. The right-click on References and click Add References.... Use the .NET tab and add Microsoft.Office.Interop.Excel, but make sure you are using the correct version (eg. 11.0.0.0 for Office 2003, 12.0.0.0 for 2007 etc. (I think...)). Then you can start using it:

using Excel = Microsoft.Office.Interop.Excel;

...

Excel.Application app = new Excel.Application();
Excel.Workbook book = app.Workbooks.Open("c:\\my_template.xls", ReadOnly: true);
Excel.Worksheet sheet = book.Worksheets[0];

...

You'll have to read up a bit on the Office API. Couple things though:

  • The user must have the same version of Office installed.
  • VS2008 supports Office 2003/2007; VS2010 supports Office 2007/2010 etc (although you can work around that).

There are also project templates that correspond to the above versions, however I've never had a chance to use them (we're stuck at Office 2003 Standard...). If you have any specific questions, I can try to answer them.

P.S. For Office 2007/2010 workbooks (i.e. XLSX) you can unzip them and work with XML files if you like. Microsoft did release the references for those file types.

nmaillet 97 Posting Whiz in Training

The Conent property only supports one visual element. If you want to add another, you'll need to use a Panel, such as a Grid, Canvas, DockPanel or just about anything else that dervies from the Panel class. Assuming you are using XAML (if not, you should) it would look something like this:

<Window x:Class="Namespace.MainWindow">
    <Grid x:Name="myGrid">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </RowDefinition>
        <HeaderControl .../>
    </Grid>
</Window>

If you then accessed it from within the MainWindow (or whatever yours is called), you could do something like:

Grid.SetRow(fileuploadobject, 1);
myGrid.Children.Add(fileuploadobject);

If it's not within the class, you could either cast the instance of the Window to MainWindow and set the access modifier for myGrid to public, or cast the Content property to a Grid.

Btw, I'm a desktop developper, so the control types you may use could differ if you are using Silverlight, but the idea should be the same.

nmaillet 97 Posting Whiz in Training

That statement will not return true for 5, for two reasons. digit would not be greater than 5, it would be equal, and 5 mod 5 equals 0. Both would be false.

I don't really understand why you are performing the checks:

if((digit%2) !=0 && (digit%3) !=0){
if((digit > 5) && (digit%5) !=0){

You should first be checking if number is divisible by digit (ie. number % digit == 0 ). Then you should add in a for loop to determine if the digit is prime; probably as another function for simplicity's sake.

Since Project Euler is generally about efficiency, I should mention that:
a) you don't need to check if(digit > biggestPrime) since i is always increasing, each time it will be greater than the last.
b) since even numbers (except 2 of course) are never prime, you do not have to check them, and there will never be a factor greater than the number divided by 2 (unless the number itself is prime). You could reduce your for-loop to:

long long int halfNumber = number / 2;
for(long long int digit = 3; digit <= halfNumber; digit += 2)

P.S. Please preview your post before submitting, or edit it right afterwards. It is much easier to read code if the CODE tags are used properly.

nmaillet 97 Posting Whiz in Training

Just to clarify:

while (A)
{
    some_method();
}
other_method();

is executed like:

If A is false go to line 4.
    some_method();
    Go to line 1.
other_method();
Jazerix commented: Thanks :) +3
nmaillet 97 Posting Whiz in Training

Right-click on your project in solution explorer and click Properties. Under Configuration Properties --> Common Language Runtime Support, ensure it is set to No Common Language Runtime Support.

When creating a new project, under Visual C++, select Win32 and then select either Win32 Console Application or Win32 Project.

Just to be sure, what are your friends installing to run it? They will require the VisualC++ Redistributable Package, as it contains libraries that they use. They should not however, require the full .NET Framework.

nmaillet 97 Posting Whiz in Training

For b &= (byte) ~a; , the compiler will check this conversion since a is a constant, and it is certain what the value will be. Since bitwise operations return int's (doesn't seem right to me), it will evaluate ~a as an int, which would evaluate to -9. I don't think there is any other way, except to use unchecked statements:

unchecked
{
    b &= (byte) ~a;
}