Ramy Mahrous 401 Postaholic Featured Poster

Define it as Parameter.

Ramy Mahrous 401 Postaholic Featured Poster

Dear AnkitKumar, please don't open more threads on the same question we are here to help but you should first need to help yourself by answering our questions.
- Please change your font
- Please tell us what line crashes with you and what's the error

Ramy Mahrous 401 Postaholic Featured Poster

MSDN says
To specify the allowable range of values for the control, set the Minimum and Maximum properties. Set the Increment value to specify the value to be incremented or decremented to the Value property when the user clicks the up or down arrow buttons. You can increase the speed that the control moves through numbers when the user continuously presses the up or down arrow by setting the Accelerations property.
And from the description I see you'll lose control functionality if you didn't set them. I didn't try it my hand but I'll.

Ramy Mahrous 401 Postaholic Featured Poster

Hey Danny, Serkan...
As I have no experience about GDI+ but I just replace this line R.Inflate(1,1); with R.Inflate(R.Size); I feel the shape changes but I don't know that's you need Danny or not.
Wish for you the best of luck in it and solve it ASAP..

Ramy Mahrous 401 Postaholic Featured Poster

Please wrap your code between code tages [code] your code here... [/code]
Mention the line of code it breaks on

Ramy Mahrous 401 Postaholic Featured Poster

You are welcome :)
Pretty simple just in file new line == \r\n not just \n
Please mark it as solved :)

Ramy Mahrous 401 Postaholic Featured Poster

Try replacing "\t" with "\r\n"

string a = System.IO.File.ReadAllText(@"c:\csnet\a1.txt");
            string b = a.Replace('\t','\r\n');
            System.IO.File.WriteAllText(@"c:\csnet\a2.txt",b);
Ramy Mahrous 401 Postaholic Featured Poster

Try replacing "\t" with "\r\n"

Ramy Mahrous 401 Postaholic Featured Poster

I don't understand the question :| adatapost how could you :) I think they need to develop and editor to this file to add\modify\remove some words.

Ramy Mahrous 401 Postaholic Featured Poster

@Danny: ooooooooooooooh I posted code, what else :)???!! and they didn't show what they wrote!

@Diamond: Thanks for your kind words.

Ramy Mahrous 401 Postaholic Featured Poster

Scott it should pop up empty message box, I tried that don't give Text or Name it works fine (I used BorderStyle) to see the label. Chrome crashes everytime I upload the proof :)

Ramy Mahrous 401 Postaholic Featured Poster

Debug your code, it's better and it saves more time.

Ramy Mahrous 401 Postaholic Featured Poster

Thanks, Scott.
Scholar, no. It's my fault I didn't note that newlabel.Name = s1; let it newlabel.Name = "name" + i;

Ramy Mahrous 401 Postaholic Featured Poster

I think you just need to change the ShowMessage() to show the .Name property instead of .Text, try this:

WHAT :) I think they should overcome this!!!

sknake commented: you would think but thats obviously not the case ;) +2
Ramy Mahrous 401 Postaholic Featured Poster

Look, I'll give you simple code
Simply when button clicked It add new label and once the created label clicked; message box shown with its Name and its Text

Label newlabel;
void BtbAddLabel_Click(object sender, EventArgs)
{
newlabel = new Label();
newlabel.AutoSize = true;
newlabel.Text = s1;
newlabel.Location = new System.Drawing.Point(50, 20+30*i);
newlabel.Name = s1;
newlabel.Size=new System.Drawing.Size(60,25);
newlabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
newlabel.Click+=new EventHandler(LabelClick);
groupBox1.Controls.Add(newlabel);
}
void LabelClick(object sender, EventArgs)
{
MessageBox.Show( ((Label)sender).Name+ " " + ((Label)sender).Text);
}
Ramy Mahrous 401 Postaholic Featured Poster

Please again clarify your request with simple scenario.

Ramy Mahrous 401 Postaholic Featured Poster

If you did a blog post explaining the solution, I'll give you everyday points for 3 days mine is 7 ;)

Ramy Mahrous 401 Postaholic Featured Poster

Please send the full code, I'm sure it should get the desired output.

Ramy Mahrous 401 Postaholic Featured Poster
foreach (string s1 in s2)
            {
                newlabel = new Label();
                newlabel.AutoSize = true;
                newlabel.Text = s1;
                newlabel.Location = new System.Drawing.Point(50, 20+30*i);
                newlabel.Name = s1;
                newlabel.Size=new System.Drawing.Size(60,25);
              
                newlabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                groupBox1.Controls.Add(newlabel);

//event handler
newlabel.Click+=new EventHandler(LabelClick);
                i++;
            }
void LabelClick(object sender, EventArgs)
{
MessageBox.Show( ((Label)sender).Text);
}
Ramy Mahrous 401 Postaholic Featured Poster

hehehehehee extraordinaryyyyyyyyyyyyyyyyyyyyyyyyyyyy

serkan sendur commented: this is an advance credit, think about it man, ten days.. +4
Ramy Mahrous 401 Postaholic Featured Poster

Thanks, Scott :) you saved my time a lot.

Ramy Mahrous 401 Postaholic Featured Poster

I love your character, Serkan really :)
I'll try that and if I could, I'll tell you.

Ramy Mahrous 401 Postaholic Featured Poster

WorkSheet.... because you use COM, which you didn't terminate it yourself and if you open the task manager you will see Test10.exe is running. Try adatapost help it solves your problem

Ramy Mahrous 401 Postaholic Featured Poster

Here you are

/* \r\n or just \n depending from where you got data text file or something esle \r*/
string[] lines = richTextBox1.Text.Split(new string[]{"\r\n"}, StringSplitOptions.None);
//you need, say to select first 3000 lines
for(int i=0; i<3000; i++)
{
richTextBox1.Append(lines[i]);
}
Ramy Mahrous 401 Postaholic Featured Poster

Sometimes, but you must answer\put work around in a blog to make it easier for whom they come after.

Ramy Mahrous 401 Postaholic Featured Poster

Here you are

if(int.TryParse(TextBox1.Text))
//good
else
MessageBox.Show("Text couldn't be converted to integer");
Ramy Mahrous 401 Postaholic Featured Poster

Can you please send code snippet it may help us to understand your well.

Ramy Mahrous 401 Postaholic Featured Poster

Comment datagridview1.dataBind(); or remove it.

Ramy Mahrous 401 Postaholic Featured Poster

It's my pleasure really adatapost when you correct for me, thanks a lot :)

kvprajapati commented: You are industrious. +3
Ramy Mahrous 401 Postaholic Featured Poster

Code tag please!!
Try that please

SqlConnection objSqlConnection = new SqlConnection();
string connectionStringSettings = "Data Source =.; Initial Catalog = LibrarySystemManagement;Integrated Security = SSPI";
private void btnSearch_Click(object sender, EventArgs e)
try
{
objSqlConnection.ConnectionString = connectionStringSettings;
objSqlConnection.Open();

if ((txtBookName.Text != "") || (txtCategory.Text != ""))
{

SqlCommand objSqlCommand = new SqlCommand("select * from LIBRARYBOOKDETAILS where Title = '"+txtTitle.Text+"'", objSqlConnection);

dataGridView1.DataSource = objSqlCommand.ExecuteReader();
//objSqlDataAdapter.Update(objDataTable);
dataGridView1.DataBind();
objSqlConnection.Close();
}
}
catch (Exception e1)
{
MessageBox.Show(e1.Message + e1.Source);
}
}
Ramy Mahrous 401 Postaholic Featured Poster

Very good adatapost, I forgot to open connection!

Ramy Mahrous 401 Postaholic Featured Poster

Please use Code Tag :)

String connectionString = System.Configuration.ConfigurationSettings.AppSettings["dsn"];

string Query = String.Format("SELECT RegNo FROM Student WHERE RegNo ='{0}' ", cmbRegNo.Text);

OleDbCommand cmd=new OleDbCommand(Query,new OleDbConnection (connectionString));

int id =(int)cmd.ExecuteScalar();
Ramy Mahrous 401 Postaholic Featured Poster

Sure!!
What you trying to do is to convert "SELECT Id FROM Student WHERE RegNo ='value' to Integral value!!
Just tel me what you need to do.
I expect you need to execute this query and take the result in the ID
So

string selectStatement = String.Format("SELECT Id FROM Student WHERE RegNo ='{0}' ", cmbRegNo.Text);
SqlCommand cmd = new SqlCommand(selectStatement, connection);
int id = (int)cmd.ExecuteScalar();
Ramy Mahrous 401 Postaholic Featured Poster

You are welcome, mundetas, Donish
Your questions are welcome :)
Please mark it as solved, mundetas

Ramy Mahrous 401 Postaholic Featured Poster

All my replies were on direction to use Windows-based application.
SURE THE LOGICAL SOLUTION is to use Web-based application (ASP.NET), it's very easy and you'll go through it quickly. Best of luck

Ramy Mahrous 401 Postaholic Featured Poster

The only applicable scenario is everyone (clients) install client application (.exe) and all the functionalities in it; talk directly to webservice which handles requests and responds back to the client.
What you need to know is
Host webservices on domain like any web application.
Talk to webservices from any client application.

All about webservices http://msdn.microsoft.com/en-us/library/ms996507.aspx

Another alternative is to use WCF, I personally recommend it http://msdn.microsoft.com/en-us/netframework/aa663324.aspx

Ramy Mahrous 401 Postaholic Featured Poster

What do you mean with online? Internet or Intranet?

Ramy Mahrous 401 Postaholic Featured Poster

I also gave the solution!!! Back to 2nd reply!

Ramy Mahrous 401 Postaholic Featured Poster

You need to press a button on web form to close a window in windows-based application?

Ramy Mahrous 401 Postaholic Featured Poster

What do you need exactly?

Ramy Mahrous 401 Postaholic Featured Poster

Serkan always overrides technical thread to personal one, really if you are banned I'll upset not having you around, but still I'll be sure there are no more replies in threads :D

Ramy Mahrous 401 Postaholic Featured Poster

ex.InnerException and plus you didn't show the error because you are working on Windows-based application
modify your catch block to

catch (Exception ex)
{
// Display any exceptions
//Console.WriteLine(ex.Message);
MessageBox.Show(ex.Message);
MessageBox.Show(ex.InnerException);
//MessageBox.Show("Transaction Failed");
// If anything failed after the connection was opened, roll back the transaction
if (txn != null)
{
txn.Rollback();
}
}
Blaine Tuisee commented: Gave me the tool, the exception message, that allowed me to find the issue +2
Ramy Mahrous 401 Postaholic Featured Poster
class MyTreeNode : TreeNode
{
//your properties
}
Ramy Mahrous 401 Postaholic Featured Poster

You can set the ToolTip of the node to these information or you can set the node text = "Folder name - Folder size"

Ramy Mahrous 401 Postaholic Featured Poster

You can't disable it. "you can't" == you can but after huge efforts. what does this sound means to you?! it means you haven't accept button on your forum, once you've this button you won't get this sound + TextBox class not getting this sound itself, but OS does.

Ramy Mahrous 401 Postaholic Featured Poster

Please clarify more, or figure on paper what you need exactly

Ramy Mahrous 401 Postaholic Featured Poster

You made me lost!!! <MediaElement source ="filePath"> it doesn't need anything from memory, I expected you need some binary representation to your file!!!!
http://msdn.microsoft.com/en-us/library/system.windows.controls.mediaelement.source.aspx

Ramy Mahrous 401 Postaholic Featured Poster

OK, I just asked you because I expected you need just to play a song from your application without interacting with Media Player or if you need to play a song file without any information about the software user uses.

So, to convert any file to its binary representative

System.IO.FileStream fs = new System.IO.FileStream(@"FilePath", System.IO.FileMode.Open);
byte[] fileAsBytes = new byte[fs.Length];
fs.Read(fileAsBytes, 0, fileAsBytes.Length);
fs.Close();

To convert it back to stream

System.IO.StreamReader sr =  new System.IO.StreamReader(new System.IO.MemoryStream(fileAsBytes));
Ramy Mahrous 401 Postaholic Featured Poster

In your case use DataGrid, it's most suitable to your case.

Ramy Mahrous 401 Postaholic Featured Poster

You need to play it?!