|
Console.WriteLine("1");
Console.WriteLine("12");
Console.WriteLine("123");
Console.WriteLine("1234");
Console.WriteLine("12345");
Console.WriteLine("1235");
Console.WriteLine("124");
Console.WriteLine("1245");
Console.WriteLine("125");
Console.WriteLine("13");
Console.WriteLine("134");
Console.WriteLine("1345");
Console.WriteLine("135");
Console.WriteLine("14");
Console.WriteLine("145");
Console.WriteLine("15");
Console.WriteLine("2");
Console.WriteLine("23");
Console.WriteLine("234");
Console.WriteLine("2345");
Console.WriteLine("235");
Console.WriteLine("24");
Console.WriteLine("245");
Console.WriteLine("25");
Console.WriteLine("3");
Console.WriteLine("34");
Console.WriteLine("345");
Console.WriteLine("35");
Console.WriteLine("4");
Console.WriteLine("45");
Console.WriteLine("5");
--Colin Mackay--
EuroCPian Spring 2004 Get Together[^]
|
|
|
|
|
|
I love your reply. It's so humorful hah...
|
|
|
|
|
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Drawing;
using System.Collections;
namespace CodeProject
{
class SillyStuff
{
[STAThread]
static void Main(string[] args)
{
ArrayList list = new ArrayList();
bool[] patt = new bool[] {false, false, false, false, false};
bool keeptruckin = true;
while (keeptruckin)
{
keeptruckin = false;
for (int loop1 = patt.GetLowerBound(0); loop1 <= patt.GetUpperBound(0); loop1++)
{
if (!patt[loop1])
{
patt[loop1] = true;
keeptruckin = true;
break;
}
else
{
patt[loop1] = false;
}
}
if (keeptruckin)
{
string buffer = string.Empty;
for (int loop2 = patt.GetLowerBound(0); loop2 <= patt.GetUpperBound(0); loop2++)
{
if (patt[loop2]) buffer += (loop2 + 1).ToString();
}
list.Add(buffer);
}
}
list.Sort();
for (int loop3 = 0; loop3 < list.Count; loop3++)
{
Console.WriteLine(list[loop3]);
}
Console.WriteLine("DONE");
}
}
}
|
|
|
|
|
You were subtle!
You got my 5!
Trying to make bits uncopyable is like trying to make water not wet.
-- Bruce Schneier
By the way, dog_spawn isn't a nickname - it is my name with an underscore instead of a space. -- dog_spawn
|
|
|
|
|
|
I want to add a text box into a template column during runtime. I can add a
boundcolumn but not with template column. I allow user to type in something
in the textbox in the datagrid. I wanna know if it's possible
public void AddNewColumn(DataGrid grid,string headerName)
{
TemplateColumn bc = new TemplateColumn();
............... something here
.................
grid.Columns.Add(bc);
}
Thanks
|
|
|
|
|
caheo wrote:
can add a
boundcolumn but not with template column.
Sure you can! Just do something like this:
<ItemTemplate>
<asp:TextBox id="tb1" runat="server"
Text="<%# DataBinder.Eval(Container.DataItem, "ColumnName") %>"/>
</asp:TextBox>
</ItemTemplate> See the documentation for TemplateColumn.ItemTemplate[^] for more information and a more thorough example.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
How can i remove this for a encryption program it won't let me make it so it shows up NOT as a '?'? Any help?
|
|
|
|
|
or even better make it show up as a hex char i dont know how though any ideas?
- LiquidKnight
|
|
|
|
|
You shouldn't be trying to display encrypted blocks in a TextBox - it's always binary until encoded in base64 or something else (base64 is most common, though).
See the ToBase64Transform and FromBase64Transform classes in the .NET base class library. The class documentation also includes a couple of good samples for how to use these two classes. You should then have no problems displaying cipher text.
Just as examples, consider PGP (http://www.pgp.com[^]): in order to send plain-text cipher text as email (it's primary use is for communications) it must be encoded. This is currently done using base64. Or when you sign-up for an SSL certificate your request must be sent using a base64 encoded public key.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I've built a fairly complex stored procedure that has a couple of selects in it that are only functional while I'm only interested in reading the resultset from the last select.
Now when I fill my dataset, apart from retrieving useless data from the database, I have to acess my data doing something like ds.Tables[2].Rows
I have thought of two possible solutions even though I don't know how to implement any of them.
1. Have the stored procedure return only the last recordset. If this is possible I'm missing some T-SQL command. Anybody on this?
2. Give a name to the table that I'm interested in reading so that I could access it disregarding it's index like ds.Tables["MyRecordset"].Rows
This is much more elegant than accessing with numeric index bacause if I change the stored procedure I don't have to change my code.
Anyway how does one give a name to a table from a stored procedure?
Thanks
Edd
|
|
|
|
|
If you are using a DataAdapter to fill you dataset you can always create a strong typed dataset which allows you to access the data as:
myDs.MyTableName[row].MyField;
or
dsMyStrongType.MyStrongTypeRow dr = myDs.MyTableName[row];
dr.MyField = something
Makes life a lot easier and less apt to have typos on field names (plus you get Intellesense). Just build your DataAdapter in the editor and the right click on it to generate a dataset. If your stored procedure returns multiple results it will build a table by name for each. You can also select the table mapping property to call the tables anything you like.
Really cool stuff.
Rocky <><
www.HintsAndTips.com
|
|
|
|
|
Add an output parameter to the stored procedure and send the Table using it.
Send me the query.
Free your mind...
|
|
|
|
|
When using DataSet s, try designing a strongly-typed DataSet by using the DataSet designer in VS.NET (there are other ways and tools, too, but I present the way in VS.NET). Right-click on your project or subfolder and select Add New Item. Find DataSet , give it a name, and click OK.
You'll see a component designer screen. Right-click to add elements (tables) and each element has rows and their types (the columns). You can even add relationships and primary keys. Just play around with it a little.
You can even use the Server Explorer if you have a database connection to drag-n-drop tables or stored procedures which returns tables to generate these automatically.
When you fill the strongly-typed DataSet , your DbDataAdapter derivative (like SqlDataAdapter ) has to be configured to map the tables. This is done through DbDataAdapter.TableMappings and can easily be configured by using the data adapter designer in VS.NET as well.
Finally, you don't even need to use strongly-typed if you use the TableMappings property mentioned above. When selecting multiple result sets, the sequence of table names is "Table", "Table1", "Table2", etc. If you map these to other names, you can use DataSet.Tables["nameOfTable"] .
I recommend using strongly-typed DataSet s, though. You can easily refer to columns by name and don't have to worry about casting since those named rows return the appropriate Type.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I must have just skipped by it, but when I was checking out the 'switch' keyword, I noticed that C# has a "goto case" fucntionality inside of a switch block to go to another case statement. Not that I would have a need for it often, but if I do it is there
Funny thing is though, since moving to .NET I seldom use switch. Just have not had a lot of need for it.
Rocky <><
www.HintsAndTips.com
|
|
|
|
|
I didn't know it too.
Mazy
No sig. available now.
|
|
|
|
|
You can get quite complex with goto and <name>: labels as long as they in scope
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Hi everybody,
Im looking for a code snippet about how can create a small program, something like that one which exist in the msn chat program for testing microphone(Ahdio/Video tuning wizard).
Any help's appreciated.
|
|
|
|
|
there is afaik no possibility to get acess to the audio hardware via the classes stored in the System Namespace
Anyway you should use nBass: http://nbass.sourceforge.net/
and the nBass DLL gives you a class called [i]record[/i]
scio me nihil scire
My OpenSource(zlib/libpng License) Engine:
http://sourceforge.net/projects/rendertech
Its incurable, its a Pentium division failure.
|
|
|
|
|
what is "afaik"?
/\ |_ E X E GG
|
|
|
|
|
As
Far
As
I
Know
Free your mind...
|
|
|
|
|
as far as I know
scio me nihil scire
My OpenSource(zlib/libpng License) Engine:
http://sourceforge.net/projects/rendertech
Its incurable, its a Pentium division failure.
|
|
|
|
|
how do you default the focus to be on a certain control when a dialog comes up?
the following line in the constructor is not doing it.
this.m_OkButton.Focus();
Elena
|
|
|
|
|
Set the TabIndex of the control you want to have initial focus to 0, adjusting the other controls with TabStop enabled. You can do this easily in VS.NET by click the View->Tab Order when a form is open in the designer.
The Focus method only works when a control (including a form) is already open.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|