|
OK - well, you need some sort of placeholder in your page, so you know where the labels will end up. The way to add a control to an ASP.NET page is to add it to the controls collection of the item that is to be it's direct parent.
If all you're doing is showing a bunch of labels, I'd be more included to use a repeater or datagrid, and bind it to your data source. Will that not work for you ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Here is what I have this may show you more...
StringBuilder szMyTable = new StringBuilder();
///The page begining
///Starts the html, body, form and table for the page
szMyTable.Append("");
///Establishes the number of tables, testboxes, and buttons using a FOR statement
foreach (string skill in skills)
{
szMyTable.Append("");
}
//End the page, then send the page to the Redirect
szMyTable.Append("");
szMyTable.Append("<asp:label id="lbl");
szMyTable.Append(skill);
szMyTable.Append("" runat="server" text="\"");
szMyTable.Append(skill);
szMyTable.Append("\"">");
szMyTable.Append(" | ");
Response.Write(szMyTable.ToString());
Response.End();
A datagrid will not work, as I am going to have the szMyTable include Textboxes and Buttons.
|
|
|
|
|
ExpertComing wrote:
szMyTable.Append("<body><form runat=server><table>");
Why are you doing this in an ASP.NET app ? This is a nightmare.
ExpertComing wrote:
szMyTable.Append("szMyTable.Append(skill);
szMyTable.Append(" runat=server Text=\"");
You can't do this, you're generating HTML *after* the controls have been created.
ExpertComing wrote:
A datagrid will not work, as I am going to have the szMyTable include Textboxes and Buttons.
You're treating asp.net as if it was asp. Scrap all this code, it's really working against the framwork. Instead, create a datagrid, which CAN include textboxes and buttons. There's a bit of work in getting the events from dynamically created controls, but it can be done, and that way, you'll use the framework instead of fighting it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
What is the difference between asp and asp.net?
Both active server pages right?
|
|
|
|
|
No, asp is the old framework, it uses VBSCript and JScript. In ASP, you have to build your result sets using the sort of code you're using. ASP.NET is the framework that gives you access to things like codebehind, code reuse, etc. It's a whole different world. There's not enough money in the world for me to ever take an asp project again.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
But they are both actice server pages, but ASPX is the more efficient one correct?
|
|
|
|
|
They are both an ISAPI filter at the end of the day. Look, ANY framework generates HTML, but that doesn't mean you can do anything you want just writing your own HTML. ASP.NET is named as it is to show that it's the successor of asp. Have you ever used asp ? If you haven't, then I have no idea why you're generating code as you are ( especially putting in body and form tags ), but I promise you, it's the difference between cutting down the tallest tree in the forest with a chainsaw, or with a wet herring.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
No, I myself, have never used asp, although my dad works for Microsoft, and he taught me how to code, he did it that way, so I do. I have never used a datagrid before, can you give me a quick lesson or article to help me out.
Thanks a ton man, you have help me threw some problems before, thanks for all your help.
|
|
|
|
|
ExpertComing wrote:
No, I myself, have never used asp
Half your luck
This[^] is the best site for info on the datagrid.
Here[^] is a good place to start on MSDN.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have the following c++ declaration
static FT_STATUS FT_ListDevicesEx(String *DevicesList);
{
DevicesList = "Hello";
}
Inside this function I modify the DeviceList string, but when I return to my c# code the string is not changed.
in c# i use the following code to pass the string.
string a = "12345";
FTDI.FT_ListDevicesEx(a);
When I arrive in ListDevicesEx the DevicesList string is 12345, then is modified in Hello, but at return in c# a = 12345 again!
What is the solution ?
Best regards.
|
|
|
|
|
You need to use the "ref" keyword from C#. Also, make sure that the "ref"-style usage is declared for the C++ function as well (if it isn't already set that way).
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
|
<br />
Regex regex = new Regex(@"(?>\w|\d|\s|\B)[^;]+"); <br />
<br />
my input:<br />
matchCollectionReceivers = regex.Matches("Gerald...'§'ö3 Hello; Mike; Fuxxe123_10");<br />
<br />
output: array[0] = "Gerald...'§'ö3 Hello";<br />
array[1] = " Mike";<br />
|------- here is a space...i dont like that!<br />
arrey[2] = " Fuxxe123_10";<br />
<br />
<br />
Regex regex = new Regex(@"(?>\w|\d|\s|\B)[^; ]+"); <---- don't work!?<br />
how can i say all characters but without "; " ?
cu
|
|
|
|
|
Have you tried [^;\s]+ ?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
What about this?
(?>\w|\d||\B)[^;\s]+
Btw, if you want to strip all string with an ; or \s between each other, why not use the String.Split() function?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hi,
<br />
input "Gerald 123; Franz!'§§"<br />
<br />
regex: Regex regex = new Regex(@"(?>\w|\d|\B)[^;\s]+");<br />
<br />
output:<br />
array[0] = "Gerald";<br />
array[1] = "123";<br />
array[2] = "Franz!'§§";<br />
<br />
but i want have: array[1] = "Gerald 123";<br />
array[2] = "Franz!'§§";<br />
<br />
i know its better to use the split function
but i want to run that with regex...but it's not possible?
cu
|
|
|
|
|
Do you actually want to split the spaces or the semicolons?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hi,
the regex should work like that:
<br />
char[] separators = new char[] {';'}; <br />
foreach (string sub in textBox_Receivers.Text.Split(separators))<br />
{<br />
string str = sub.Substring(0, sub.Length);<br />
if(str.StartsWith(" ")) <br />
{<br />
str = str.Remove(0,1); <br />
}<br />
<br />
Receivers.Add(str);<br />
} <br />
cu
-- modified at 16:05 Thursday 8th September, 2005
|
|
|
|
|
\s?([^;]+)
This one works fine for me
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hi,
yeah thats fine:
<br />
MatchCollection matchCollectionReceivers;<br />
Regex regex = new Regex(@"\s?([^;]+)"); <------- whats the '?' here? = AND?<br />
matchCollectionReceivers = regex.Matches(textBox_Receivers.Text);<br />
<br />
foreach (Match m in matchCollectionReceivers) <br />
{ <br />
string str = m.Value;<br />
if(str.StartsWith(" "))<br />
{<br />
str = str.Remove(0,1);<br />
}<br />
<br />
Receivers.Add(str);<br />
}<br />
advantage: less code lines than the .split() version
cu+thx
|
|
|
|
|
No, the ? means that the space is optional.
But your code is wrong - I put brackets around the [^;]+ so that the results will be stored in a GroupCollection. This way you don't need to check for any leading spaces anymore.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Regex r = new Regex(@"\s?([^;]+)");
MatchCollection m = r.Matches("Gerald 123; Franz!'§§");
foreach (Match mc in m)
{
Console.WriteLine(mc.Groups[1].ToString());
}
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hi, look for my last code past! i can see brackets around: Regex regex = new Regex(@"\s?([^;]+)");
why do you write mc.Groups[1]? in m.Groups[2] are the space?
cu
|
|
|
|
|
mc.Groups[0] is the whole matched group including the optional space, while mc.Groups[1] is the group matched by the ([^;]+)
There is no mc.Groups[2] as far as I know.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Forgive my ignorance, I am often given small tasks on projects where I have little experience, and not a lot of time for a learning curve on so short a task.
I've been asked to make minor mods to a C program.
The files I have are .cpp and .h . This is C, as opposed to C++, correct?
And I cannot (at least, not effectively) edit and compile this in Visual Studio? (There is no .sln file and the .cpp and .h files do not show up as 'add existing'-able files.)
I'm googling for answers about how I'm going to go about this, but most info out there sort of starts at a lower level of info than I'm looking for.
I'll probably be back with more questions when I go to compile and such (like where do I get/put all the class libraries and stuff), so any preemptive help on the 'start-to-end' of a C program is appreciated.
Thanks.
________________________________________________________________________
Dave
Y10K bug! Let's not get caught with our pants down **AGAIN**! (DC 02002)
|
|
|
|