|
My problem is: i have a dropdownlist1, a button1, lable1, label2; when i click into dropdownlist1 and select a number that i want, the page will re-draw dynamic TextBoxes, these TextBoxes allow u type data into. when i click button1, data in these TextBoxes is saved.
my code:
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList DropDownList1;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Button Button1;
Label[] lb = new Label[7];
TextBox[] te = new TextBox[7];
string[] s={"a", "b", "c", "d","e","f", "g", "h"};
protected System.Web.UI.WebControls.Panel Panel1;
int so=0;
private void Page_Load(object sender, System.EventArgs e)
{
Panel1.Width = 300;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
so=Convert.ToInt32(DropDownList1.SelectedValue);
for(int i=0;i
|
|
|
|
|
i want to read multiple pictres and to store their colors pixels value into matrix.
i need this matrix 3d...as the first 2d to the dimensions of the pictures and the third dimension to represent the number of the picture(i.e 1st picture , 2nd picture .......)
how can i do that?
haitham
|
|
|
|
|
How about a 3D array:
ColorPixel[,,] colorPix = new ColorPixel[xPos, yPos, picIndex];
Best,
Jun
|
|
|
|
|
3D is what i want but u mean by "colorpixel" a type or u wrote it as example for any other type
cause i searched for it in the msdn and i didn`t find it in the msdn
thanks for ur reply jun.
haitham
|
|
|
|
|
eng:haitham wrote: u wrote it as example for any other type
Yes, whatever type (e.g., int) you want "ColorPixel" to be.
Best,
Jun
|
|
|
|
|
i tried to use these lines of codes:
[CODE]
public class PrintingExample : System.Windows.Forms.Form
{
private System.ComponentModel.Container components;
private System.Windows.Forms.Button printButton;
private Font printFont;
private StreamReader streamToPrint;
public PrintingExample() : base()
{
// The Windows Forms Designer requires the following call.
InitializeComponent();
}
// The Click event is raised when the user clicks the Print button.
private void printButton_Click(object sender, EventArgs e)
{
try
{
streamToPrint = new StreamReader
("C:\\My Documents\\MyFile.txt");
try
{
printFont = new Font("Arial", 10);
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler
(this.pd_PrintPage);
pd.Print();
}
finally
{
streamToPrint.Close();
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
// The PrintPage event is raised for each page to be printed.
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
float linesPerPage = 0;
float yPos = 0;
int count = 0;
float leftMargin = ev.MarginBounds.Left;
float topMargin = ev.MarginBounds.Top;
string line = null;
// Calculate the number of lines per page.
linesPerPage = ev.MarginBounds.Height /
printFont.GetHeight(ev.Graphics);
// Print each line of the file.
while(count < linesPerPage &&
((line=streamToPrint.ReadLine()) != null))
{
yPos = topMargin + (count *
printFont.GetHeight(ev.Graphics));
ev.Graphics.DrawString(line, printFont, Brushes.Black,
leftMargin, yPos, new StringFormat());
count++;
}
// If more lines exist, print another page.
if(line != null)
ev.HasMorePages = true;
else
ev.HasMorePages = false;
}
// The Windows Forms Designer requires the following procedure.
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.printButton = new System.Windows.Forms.Button();
this.ClientSize = new System.Drawing.Size(504, 381);
this.Text = "Print Example";
printButton.ImageAlign =
System.Drawing.ContentAlignment.MiddleLeft;
printButton.Location = new System.Drawing.Point(32, 110);
printButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
printButton.TabIndex = 0;
printButton.Text = "Print the file.";
printButton.Size = new System.Drawing.Size(136, 40);
printButton.Click += new System.EventHandler(printButton_Click);
this.Controls.Add(printButton);
}
// This is the main entry point for the application.
public static void Main(string[] args)
{
Application.Run(new PrintingExample());
}
}
replacing :
streamToPrint = new StreamReader
("C:\\My Documents\\MyFile.txt");
try
with :
streamToPrint = new StreamReader
("http://www.google.com");
try
but it has an error message : " URI format not supported"
so what must i do so that i can print url format?
[/CODE]
-- modified at 22:21 Sunday 25th June, 2006
|
|
|
|
|
Wow, what a long post...
Anyway, StreamReader class can't read remote web pages by itself -supposingly-. You should check the System.Net namespace for classes that read html pages -eg. HttpWebRequest-
By the way, this way you will print the Html of the page. Why don't you check the WebBrowser component? It has a Print() method.
|
|
|
|
|
hi
i want to envrypt/decrypt data (for example video stream) on the fly and play it ?
thanks
|
|
|
|
|
Take a look at the CryptoStream class, acts just like a stream only downside is that I don't think it will finish encrypting or decrypting until the stream is closed (I might have got this confused with the compressor streams such as Gzip but I'm not sure).
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
When I see the application which developed by other people are so cool ,while I can not achieve.Who can tell me how to make the application more cool.
No begin no end.
|
|
|
|
|
Hello
The "cool" word is a bit ill descriptive. Simply the answer to your question is another question:
What did you see in those applications that made you say they are "cool"?
If you already know that answer, then do the same in your applications, but of course in an innovative way -not imitative, ie. don't just copy ideas-
Some hints that might be useful:
1- Your user interface must be compact, user friendly -ie. relaxing to the eye at first look-, yet efficient
2- Your application must have a "genuine" idea -Perhaps this is the most important thing-
3- Your application must be easy to learn, and for advanced features, there should be tutorials or "easy to get" helps
4- Preferably support both beginner, and advanced users
These are not -must follow- rules, just few hints.
|
|
|
|
|
See if we can come up with right phrases for a good application based on your hints:
1 - User Friendly
2 - Creative
3 - Intuitive
4 - Versatile
Best,
Jun
|
|
|
|
|
Nice!!;)
I like the "Shortest distance between two points is a straight line" thinking of yours Jun.
|
|
|
|
|
|
|
Colin Angus Mackay wrote: Talking to yourself?
second time last week someone whined "can't find it on google" 20 seconds later... there it is on my google results. You really gotta wonder when they can't even use a search engine maybe they should consider a different field.
|
|
|
|
|
Hello guys,
I have the following Regular Expression, I want to convert it from PHP to C#.
$aVar = preg_replace("/[\r\n]{1,2}(.+)\#(.*)[\r\n]{1,2}/U", "$myRightVar\\1$myCenterVar\\2$myLeftVar\r", $aVar);
( http://www.php.net/preg_replace )
I tried a lot but I failed. Can you please help me. Thanks.
|
|
|
|
|
The Regex is okay, at least it compiles and Expresso doesn't complain. What shall it match actually?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I'm new to C#. This is the first time I'm using Regular expression. Can you give me the complete C# tag please?
What the code does is taking any line that contains # charachter and add $myRightVar at the beginning of the line then replace # with $myCenterVar and add $myLeftVar at the end of the line.
|
|
|
|
|
|
string regex=@"[\r\n]{1,2}(.+)\#(.*)[\r\n]{1,2}";
string replace=String.Format("{0}\\1{1}\\2{2}\r",myRightVar,myCenterVar,myLeftVar);
string output=Regex.Replace(input,regex,replace);
Haven't got VS in front of me, but this (hopefully) should work.
Graham.
-- modified at 15:34 Sunday 25th June, 2006
|
|
|
|
|
It's almost working... the problem is I'm NOT getting the old left text and the old right text shown. I'm getting \1 and \2.
What's wrong?
Many thanks.
|
|
|
|
|
This is a different approach, maybe it works for you?
string regex = @"[\r\n]{1,2}(.+)\#(.*)[\r\n]{1,2}";
Match m = Regex.Match(input, regex);
if (m.Success)
{
string output = String.Format("{0}{1}{2}{3}{4}\r", myRightVar, m.Groups[1], myCenterVar, m.Groups[2], myLeftVar);
Console.WriteLine(output);
}
Probably this might also work, it's way shorter:
string output2 = Regex.Replace(input, regex, String.Format("{0}$1{1}$2{2}\r", myLeftVar, myCenterVar, myRightVar));
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks a lot but it didn't work for me
The string I am parsing contains the following:
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla.
toto toto toto # toto toto toto
toto toto toto # toto toto toto
toto toto toto # toto toto toto
toto toto toto # toto toto toto
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla.
So I want to add alter the content on the following way:
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla.
[myLeftVar]toto toto toto [myCenterVar] toto toto toto[myRightVar]
[myLeftVar]toto toto toto [myCenterVar] toto toto toto[myRightVar]
[myLeftVar]toto toto toto [myCenterVar] toto toto toto[myRightVar]
[myLeftVar]toto toto toto [myCenterVar] toto toto toto[myRightVar]
And so on...
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla.
Please help.
|
|
|
|
|
This should be it.
string regex=@"(.+)\#(.+)\r\n";
string replace=String.Format("{0}$1{1}$2{2}\r\n","Left","Center","Right");
string output=Regex.Replace(input,regex,replace);
I've tweaked the regex as I was having problem with it.
I've dumped the code I used to test it:
using System;
using System.Text.RegularExpressions;
public class Testy
{
public static void Main()
{
string input="bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla.\r\n\r\n"+
"toto toto toto # toto toto toto\r\n"+
"toto toto toto # toto toto toto\r\n"+
"toto toto toto # toto toto toto\r\n"+
"toto toto toto # toto toto toto\r\n\r\n"+
"bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla";
string regex=@"(.+)\#(.+)\r\n";
string replace=String.Format("{0}$1{1}$2{2}\r\n","Left","Center","Right");
string output=Regex.Replace(input,regex,replace);
Console.WriteLine(output);
}
}
|
|
|
|