|
Colin Angus Mackay wrote: You should link back to the original use of the quote for reference too.
Maybe I'll do, thank you for suggesting.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
As far as I remember there a many articles about CSV-files here on CodeProject.
Please use the search functionality.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi everyone,
Before I go mad trying myself, does anyone have a regular expression I could drop into some C# code that scans a .cpp file and finds all the lines that are the start of functions.
Basically I'm trying to take some source like
void MyClass::SomeFunction( int someParams )
{
.. do stuff
}
and turn it into
void MyClass::SomeFunction( int someParams )
{
MY_INSERTED_MACRO( "MyClass::SomeFunction()" )
.. do stuff
}
(i.e. I need to recognise a line is a function, and pull out the class name and function name)
[edit]
So far I've come up with this:
\w*\s(?<class>\w*)::(?<func>\w*)\(.*\)</func></class>
but that gets a few false positives
modified on Tuesday, December 23, 2008 6:31 AM
|
|
|
|
|
Sorry. Misread the original post.
Come on... You should know better than to post in the wrong forum. Try the C++ forum[^] instead.
modified on Tuesday, December 23, 2008 6:33 AM
|
|
|
|
|
No, I want C# code to parse C++ code
|
|
|
|
|
My bad.
|
|
|
|
|
This one does work for the test case, you may need to extend it for other classes etc.:
MyClass::.+\)(\r?\n?)*{
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hai
In my application,I dynamically created tabpages in my winform.
ie i have a button"Add new tab"
when i click on that button ,
a new tabpage is created.
but that tabpage is a usercontrol.
when i clicking again and again same usercontrol is regenerated as tabpage
but the problem is when i am calling properies(which i am created in userctrl.cs page) i ve to retrieve values of controls(txtbox,ddl...) present in usercontrol according to tabcount
ie if tabcount is 1,i need value of controls present in userctrl of tabpage1,then same of tabpage2
I used a for loop
userctrl uctr;
class obj;
for(i=0;i<intTabcount;i++)
{
obj.data=uctr.txtData;// data is proprty of class class
------//txtData is proprty of usrctrl
------
}
but i am getting "" as value
pls help me to solve pblm
|
|
|
|
|
What are you adding your user controls to and how?
Normally, you'd use a TabControl. That has a TabPages property of type TabPageCollection. To retrieve data from a particular page you use that page's index. To get all of them you'd use a foreach or a for loop like yours and an index of i for to get the individual page.
StringBuilder allTextBuilder = new StringBuilder();
foreach (TabPage item in tabControl1.TabPages)
{
allTextBuilder.AppendLine(item.Text);
}
string allText = allTextBuilder.ToString();
StringBuilder allTextBuilder2 = new StringBuilder();
for (int i = 0; i < tabControl1.TabPages.Count; i++)
{
allTextBuilder2.AppendLine(tabControl1.TabPages[i].Text);
}
string allText2 = allTextBuilder2.ToString();
string tabPageText = tabControl1.TabPages[0].Text;
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
my usercontol contains textboxes,datagridview and another usercontrol.I placed it statically.
I am using multitier architecture.
I created get and set property of controls of usercontrols in its codebehind page. Problem while looping through each tab i am not getting values enterd in textbox.Only thing i am getting is "" value
|
|
|
|
|
Still not exactly sure how you're referencing your user controls and you haven't shown your property getter and setter so it's impossible to determine the cause of your problem.
However, in the spririt of Christmas - here's some working code.
Form1 already has a TabControl (tabControl1) with the default TabPage s removed and a Button (button1).
UserControl1 already has a TextBox (textBox1).
I've shown two ways. The first uses an event raised from a UserControl1 instance. The second itterates through all the user controls on all pages.
using System;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
TabPage[] pages;
TabPage page0;
TabPage page1;
public Form1()
{
InitializeComponent();
page0 = new TabPage("Page 0");
UserControl1 userControl1 = new UserControl1();
page0.Controls.Add(userControl1);
userControl1.TextDataChanged += new EventHandler(userControl1_TextDataChanged);
page1 = new TabPage("Page 1");
page1.Controls.Add(new UserControl1());
pages = new TabPage[] { page0, page1 };
tabControl1.TabPages.AddRange(pages);
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(GetPagesTextData());
}
void userControl1_TextDataChanged(object sender, EventArgs e)
{
Text = ((UserControl1)sender).TextData;
}
public string GetPagesTextData()
{
StringBuilder textDatasBuilder = new StringBuilder();
foreach (TabPage page in tabControl1.TabPages)
{
foreach(Control c in page.Controls)
{
if(c is UserControl1)
textDatasBuilder.AppendLine(((UserControl1)c).TextData);
}
}
return textDatasBuilder.ToString();
}
}
}
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class UserControl1 : UserControl
{
private string textData;
public event EventHandler TextDataChanged;
public UserControl1()
{
InitializeComponent();
textBox1.TextChanged += new System.EventHandler(textBox1_TextChanged);
}
public string TextData
{
get { return textData; }
set
{
if (textData != value)
{
textData = value;
OnTextDataChanged(EventArgs.Empty);
}
}
}
protected virtual void OnTextDataChanged(EventArgs e)
{
EventHandler eh = TextDataChanged;
if (eh != null)
eh(this, e);
}
void textBox1_TextChanged(object sender, System.EventArgs e)
{
TextData = ((TextBox)sender).Text;
}
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
sendtosreejith wrote: userctrl uctr;
class obj;
How can you get the usercontrol on the tabpage? You cannot get the value from the control if you just declared it. BTW, if you can obtain the custom usercontrol in a proper way, you will get the correct value. I have tried this simply in my code. Such as:
for (int i = 0; i < this.tabControl1.TabPages.Count; i++ )
{
UserControl1 u = this.tabControl1.TabPages[i].Controls[0] as UserControl1;
Console.WriteLine(u.Text);
}
Hope this can help you.
LuckyBoy
|
|
|
|
|
how to
DataGridView Column no accept tab?
|
|
|
|
|
I don't know. What the hell does this mean ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
My question is can we use C++ or Code blocks to print the output on a paper. I got the following code. Does this prints on a paper.
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
ofstream printer( "prn" );
if (!printer)
{
cout << "fooey!\n";
return 1;
}
printer << "Hello world!\n";
printer.close();
return 0;
}
|
|
|
|
|
This is the C# forum.
You wanna ask your question in the C++ forum.
Kristian Sixhoej
|
|
|
|
|
You should probably ask in the c++ forum!
(If you've got code, why not try it?)
|
|
|
|
|
Razanust wrote: I got the following code. Does this prints on a paper.
NO.
Razanust wrote: My question is can we use C++ or Code blocks to print the output on a paper.
Yes. But you are in wrong forum. Try C++/MFC board.
|
|
|
|
|
please give me details description of Delegate
how where any we use this word....
rizvan sivally
|
|
|
|
|
A delegate is a reference to a function. All events are delegates.
Stop reading magazines on the toilet and thinking you can post some buzzwords here and become a programmer. Buy a book, work through it, ask questions here when you have at least some basic idea, these forums are to help programmers who are stuck, not to help people who are incapable of buying a book, or using google.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Welcome in the CP's Memorable Quotes page [^], Christian.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Check the links
[^]"> [^]">
Cheers!!
Brij
|
|
|
|
|
|
please expalin me in details object,class,method....
due to i am little bit in problem to how i use method,object and class.
rizvan sivally
|
|
|
|
|
sheemap wrote: i am little bit in problem
No, you are having big problems.
First of all read this[^]. Then buy a c# book for beginner and start reading it.
|
|
|
|