Click here to Skip to main content
15,898,222 members
Home / Discussions / C#
   

C#

 
GeneralRe: Progress Bar Problem Pin
Syed Shahid Hussain31-Jul-08 17:29
Syed Shahid Hussain31-Jul-08 17:29 
GeneralRe: Progress Bar Problem Pin
Ravi Bhavnani1-Aug-08 1:55
professionalRavi Bhavnani1-Aug-08 1:55 
GeneralRe: Progress Bar Problem Pin
Syed Shahid Hussain1-Aug-08 2:36
Syed Shahid Hussain1-Aug-08 2:36 
QuestionRunning object table changed event Pin
Green Fuze31-Jul-08 0:57
Green Fuze31-Jul-08 0:57 
QuestionModeless Form with invisible controls [SOLVED] [modified] Pin
#realJSOP31-Jul-08 0:41
professional#realJSOP31-Jul-08 0:41 
QuestionHow to Call C#.Net dll from VB6.0 Pin
rajesh4u31-Jul-08 0:36
rajesh4u31-Jul-08 0:36 
AnswerRe: How to Call C#.Net dll from VB6.0 Pin
Simon P Stevens31-Jul-08 0:45
Simon P Stevens31-Jul-08 0:45 
QuestionSeeking help with error checking codes in the stack builder program shown. Pin
Angelinna31-Jul-08 0:17
Angelinna31-Jul-08 0:17 
This code is working perfectly BUT am seeking help with the three possible error codes codes in the places numbered 1,2,and 3

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Stackbuilder
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
stackTop = -1;
}

private int[] stackArray = new int[10];
private int stackTop;
private int val;
private int topValue;
private int peekValue;
private int k;

private void displayStack()
{
string nextItem;

displayBox.Clear();
for (int i = 0; i <= stackTop; i++)
{
nextItem = stackArray[i].ToString();
displayBox.AppendText(nextItem);
displayBox.AppendText("\n");
}
}

private Boolean emptyStack()
{
return (stackTop == -1);
}

private void displaybutton_Click(object sender, EventArgs e)
{
displayStack();
}

private void initbutton_Click(object sender, EventArgs e)
{

stackTop = -1;
displayStack();

}
1. // add error-checking code here
private void pushbutton_Click(object sender, EventArgs e)
{
try
{
val = Convert.ToInt32(valueBox.Text);
valueBox.Clear();
}
catch
{
MessageBox.Show("Please enter an integer.");
valueBox.Focus();
return;
}

stackTop = stackTop + 1;
stackArray[stackTop] = val;

displayStack();
valueBox.Focus();
}

2. //add error-checking code here
private void popbutton_Click(object sender, EventArgs e)
{
stackTop = stackTop - 1;

displayStack();
}

3. //add error-checking code here
private void topbutton_Click(object sender, EventArgs e)
{
topValue = stackArray[stackTop];

displayBox.Clear();
displayBox.AppendText("Most recently added item is \n");
displayBox.AppendText(topValue.ToString());
displayBox.AppendText("\n");
}

//add code here to implement peek function
private void peekbutton_Click(object sender, EventArgs e)
{
peekValue = stackArray[stackTop - 1];
displayBox.Clear();
displayBox.AppendText("The item below the most recently added item is \n");
displayBox.AppendText(peekValue.ToString());
displayBox.AppendText("\n");
}

}
}
AnswerRe: Seeking help with error checking codes in the stack builder program shown. Pin
AhsanS31-Jul-08 0:37
AhsanS31-Jul-08 0:37 
Questionnormalize URL Pin
George_George31-Jul-08 0:13
George_George31-Jul-08 0:13 
AnswerRe: normalize URL Pin
leppie31-Jul-08 0:16
leppie31-Jul-08 0:16 
GeneralRe: normalize URL Pin
George_George31-Jul-08 0:18
George_George31-Jul-08 0:18 
GeneralRe: normalize URL Pin
DaveyM6931-Jul-08 0:26
professionalDaveyM6931-Jul-08 0:26 
GeneralRe: normalize URL Pin
George_George31-Jul-08 0:59
George_George31-Jul-08 0:59 
QuestionDynamic Accessibility Pin
DaveyM6931-Jul-08 0:12
professionalDaveyM6931-Jul-08 0:12 
QuestionShare point problem Pin
manju#12330-Jul-08 23:45
manju#12330-Jul-08 23:45 
GeneralRe: Share point problem Pin
Simon P Stevens31-Jul-08 0:06
Simon P Stevens31-Jul-08 0:06 
GeneralRe: Share point problem Pin
manju#12331-Jul-08 0:31
manju#12331-Jul-08 0:31 
QuestionRecord Audio from Internet Explorer Pin
Malenko30-Jul-08 23:28
Malenko30-Jul-08 23:28 
QuestionA quick question about volatile Pin
Megidolaon30-Jul-08 23:27
Megidolaon30-Jul-08 23:27 
AnswerRe: A quick question about volatile Pin
Guffa30-Jul-08 23:44
Guffa30-Jul-08 23:44 
AnswerRe: A quick question about volatile Pin
Mike Dimmick31-Jul-08 0:13
Mike Dimmick31-Jul-08 0:13 
AnswerRe: A quick question about volatile Pin
Megidolaon31-Jul-08 1:11
Megidolaon31-Jul-08 1:11 
GeneralRe: A quick question about volatile Pin
Mike Dimmick31-Jul-08 1:32
Mike Dimmick31-Jul-08 1:32 
GeneralRe: A quick question about volatile Pin
Guffa31-Jul-08 1:37
Guffa31-Jul-08 1:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.