16,015,756 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by cadsolution (Top 34 by date)
cadsolution
14-Jan-16 5:10am
View
But i couldn't solve this problem from my self thats why i can share with you.so should solve and suggest the correct one.
cadsolution
14-Jan-16 4:27am
View
in this my code iam using timing is one to nine then its ok.if i want to use moretha nine then stack.pop() stack empty error shown .please see images.also note red color comments in figure1.and figure2 is after debugging error shown like
cadsolution
14-Jan-16 4:11am
View
Deleted
.
cadsolution
14-Jan-16 4:09am
View
here is my error please download below links for better idea.
http://www.mediafire.com/view/4gneoo4uuzb25gb/FIGURE_1%282%29.jpg http://www.mediafire.com/view/regk1u36oyrik37/FIGURE_2%282%29.jpg
here is my code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace txtbox_Content_Sum
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int combinedSum = 0;
for (char letter = 'A'; letter <= 'D'; letter++)
{
int sum = 0;
var stack = new Stack<string>();
int stackSum = 0;
foreach (string line in textBox1.Lines)
{
string temp = line.Replace(".", "").Replace(" ", ""); // remove dots and spaces
if (temp == "") continue; // ignore blank line
bool containsLetter = (line.IndexOf(letter) > -1);
char first = temp[0];
char last = temp[temp.Length - 1];
if (Char.IsDigit(first))
{
string numStr = temp.Split('-')[0];
if (!containsLetter) numStr = "0";
if (stack.Count == 0)
{
sum += int.Parse(numStr);
}
else
{
stack.Push(numStr);
}
if (Char.IsDigit(last))
{
int multiplier = last - 48;
char bracket = temp[temp.Length - 2];
int total = 0;
char openChar = '\0';
string tempStr;
if (bracket == '}')
openChar = '{';
else if (bracket == ']')
openChar = '[';
else if (bracket == ')')
openChar = '(';
else if (bracket == '>')
openChar = '<';
do
{
tempStr = stack.Pop();
int num;
if (int.TryParse(tempStr, out num)) total += num;
}
while (tempStr[0] != openChar);
stackSum = (stackSum + total) * multiplier;
if (stack.Count == 0)
{
sum += stackSum;
stackSum = 0;
}
}
}
else
{
stack.Push(first.ToString());
int index = 1;
while (true)
{
if (Char.IsDigit(temp[index])) break;
stack.Push(temp[index].ToString());
index++;
}
string numStr2 = temp.Substring(index).Split('-')[0];
if (!containsLetter) numStr2 = "0";
stack.Push(numStr2);
if (Char.IsDigit(last))
{
int multiplier = last - 48;
char bracket = temp[temp.Length - 2];
int total = 0;
char openChar = '\0';
cadsolution
13-Jan-16 7:39am
View
stack empty error shown when iam using morethan 1-9.
tempStr = stack.Pop();
please solve this problem.i could not solve this my side.
cadsolution
11-Dec-15 0:46am
View
if iam using in textbox
[12-A
12-B]9 this is caluculate sum = 216 ok but if iam using more than 9 like 99 or 999 but sum not calucate.this is the problem.
cadsolution
3-Nov-14 4:12am
View
its,ok,but does it not possible without any dataset or datatable.
plz any idea of code letme urgently
cadsolution
1-Nov-14 13:15pm
View
how to pass the value to label from datagridview cell automatically when i change the value with out any click.
cadsolution
1-Nov-14 12:26pm
View
thankyou Pikoh
cadsolution
21-Oct-14 1:22am
View
hello,could anybody help for code
cadsolution
18-Oct-14 4:56am
View
this is my textbox details
this.textBox1.Location = new System.Drawing.Point(11, 121);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox1.Size = new System.Drawing.Size(100, 128);
this.textBox1.TabIndex = 4;
this.textBox1.Text = "1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13\r\n14\r\n15\r\n16\r\n17\r\n18\r\n19\r\n20\r\n21\r\n22\r\n23" +
"\r\n24\r\n25\r\n26\r\n27\r\n28\r\n29\r\n30\r\n31\r\n32\r\n33\r\n34\r\n35\r\n36\r\n37\r\n38\r\n39\r\n40";
but my print or printpreview shown only 21 in one page
and balance not printed in second page
plz correct the code
cadsolution
11-Oct-14 3:15am
View
hi,
i tried but not solved,plz solve this problem
cadsolution
11-Oct-14 3:14am
View
Could anybody solve this issue.still pending
cadsolution
8-Oct-14 9:26am
View
form1
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnOpenForm2_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2(this);
f2.ShowDialog();
}
public string ListBoxValue
{
get { return listBox1.SelectedItem.ToString(); }
}
}
form2
public partial class Form2 : Form
{
Form1 f1;
public Form2(Form1 f1)
{
this.f1 = f1;
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
textBox1.Text = this.f1.ListBoxValue;
}
}
i use above code but when i select and click edit button ,form2 open with text but after change text and click ok then its not updated ,means added new item.
where is my stuck problem.solve this.
rgds
cadsolution
30-Sep-14 3:43am
View
Dear Sergey
Thanks.
Please Share me the code actually what i need .my purpose is i want to draw color on form1 datagrid view cell from form2 panel seclected color.
share me the code please.
cadsolution
29-Sep-14 3:09am
View
please anybody solve this my problem
cadsolution
25-Sep-14 5:08am
View
ok,but my 11th coloumn is not editable.when i press number its not enter value
cadsolution
25-Sep-14 1:30am
View
any body solve this problem please
cadsolution
24-Sep-14 6:34am
View
anybody help me friends
cadsolution
24-Sep-14 3:22am
View
rightclick on panel1 for color select eg red color i selected.
now i want to panel back colr red drop to on panel2
means panel1 red color should be same on panel2 red color
cadsolution
23-Sep-14 2:10am
View
private StringReader myReader;
private void printToolStripMenuItem_Click(object sender, EventArgs e)
{
printDialog1.Document = printDocument1;
string strText = this.richTextBox1.Text;
myReader = new StringReader(strText);
if (printDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.Print();
}
}
private void printPrieviewToolStripMenuItem_Click(object sender, EventArgs e)
{
string strText = this.richTextBox1.Text;//read text for richtextbox
myReader = new StringReader(strText);
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.ShowDialog();
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
string line = null;
Font printFont = new System.Drawing.Font("Times New Roman", 8, FontStyle.Regular);
SolidBrush myBrush = new SolidBrush(Color.Black);
float linesPerPage = 0;
float topMargin = 590;
float yPosition = 590;
int count = 0;
float leftMargin = 70;
linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics);
while (count < linesPerPage && ((line = myReader.ReadLine()) != null))
{
if (count == 0)
{
yPosition = 590;
topMargin = 590;
}
else
{
yPosition = 100;
topMargin = 100;
}
yPosition = topMargin + (count * printFont.GetHeight(e.Graphics));
e.Graphics.DrawString(line, printFont, myBrush, leftMargin, yPosition, new StringFormat());
count++;
}
if (line != null)
{
e.HasMorePages = true;
}
else
{
e.HasMorePages = false;
myBrush.Dispose();
}
}
}
}
but problem is not solved,
its print in first page start with 100 margin and also print it double margin 590 in first page also same as continued in page2 also
plz solve this problem
cadsolution
22-Sep-14 6:35am
View
no of pages we dont know,may be 5 or more but pages are as per enterd text in textbox
cadsolution
22-Sep-14 6:02am
View
all pages 590 margin
but i want first page 590 margin and continued to next page 100 margin
cadsolution
22-Sep-14 1:52am
View
iam tryieng but my problem is not solved,plz help me.
cadsolution
22-Sep-14 1:23am
View
plz anybody share me the code
cadsolution
20-Sep-14 8:42am
View
k,plz share me code
cadsolution
20-Sep-14 3:51am
View
its print in first page correctly what i need margin i.e top margin = 590,but problem is second page also print same position i e. top margin 590,i want to print second page top margin is to be continued from 100
cadsolution
5-Sep-14 2:04am
View
hi,
if i use math.floor(d).tostring();
it shows 123 but when i multiplied with 12 answe will come = 123.45 x 12 = 1481.40
but answer should be = 123 x 12 = 1476
help me?
cadsolution
4-Sep-14 1:52am
View
thanks it is work fine.
cadsolution
5-Jul-14 1:36am
View
dear friend,
iam unable to get the idea of coding.plz this time help me.
cadsolution
2-Jul-14 9:03am
View
iam trying myself,but iam unable to get correct so plz help us.
cadsolution
2-Jul-14 3:50am
View
dear damithSL
thanks for answer but i want user enterd values total
iam using below code like
int sum = textBox1.Lines.Sum(line => int.Parse(new String(line.
Where(x => Char.IsDigit(x)).ToArray())));
this can be used enterd any value
but i could not code when i using multi brackets
plz help me.
cadsolution
2-Jul-14 3:14am
View
15-A
15-A IS 30
{[2-A
2-B]3
5-C}2.
MEANS FIRST (2-A + 2-B) * 3 TIMES = I.E 12
AGAIN BIG BRACKET (5-C .IE 12+5-C)*2 TIMES = 34
LAST 8-D
FINAL SUM IS = 72
cadsolution
14-Jun-14 5:10am
View
i want to creat user defined image like click below link
http://www.mediafire.com/view/zyd1lo6v51valp8/001.jpg
Show More