Ramy Mahrous 401 Postaholic Featured Poster

So, you have Child Form which opens from the button... you'll implement the event Form Closed of the Child Form to execute this piece of code

yourButton.Enabled = true;
Ramy Mahrous 401 Postaholic Featured Poster

Sorry! but is it in Windows application or web-based application? If you want to convert it to array of bytes so...

System.Drawing.Image img;
....//any operation on img instance
....//any operation on img instance
....//any operation on img instance
System.IO.FileStream fs = new System.IO.FileStream(imagePath, System.IO.FileMode.Open);
img.Save(fs);
byte[] imageAsBytes = new byte[fs.Length];
fs.Read(imageAsBytes, 0, imageAsBytes.Length);
fs.Close();
//imgaeAsBytes is array of Byte to your image
Ramy Mahrous 401 Postaholic Featured Poster

Work with MemoryStream it may help to separate your operations and the physical file.

Ramy Mahrous 401 Postaholic Featured Poster

Reasonable! :) should have typical copy on temp folder and work on it, if your operation successed then you delete the original one.

Ramy Mahrous 401 Postaholic Featured Poster
System.IO.File.Delete(FilePath);
Ramy Mahrous 401 Postaholic Featured Poster

Handle Keypressed event of the textbox

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            char lastChar = e.KeyChar;
            //MessageBox.Show(((int)e.KeyChar).ToString());
            if (e.KeyChar != 32 && e.KeyChar !=8) //allows space and backspace
            {
                if (char.IsControl(lastChar) || char.IsDigit(lastChar) || char.IsNumber(lastChar) || char.IsPunctuation(lastChar))
                    e.Handled = true;
                else if (lastChar < 1575)//the start of ascii codes for Arabic chars.
                    e.Handled = true;
            }
        }
Ramy Mahrous 401 Postaholic Featured Poster

Don't give generic answers :) all BI features not exist in Standard edition :) http://www.microsoft.com/sqlserver/2005/en/us/compare-features.aspx#busintell

Ramy Mahrous 401 Postaholic Featured Poster

Nothing more consistency... ensure that your shared object if exists is consistant by i.e using Lock

Ramy Mahrous 401 Postaholic Featured Poster

Can you replace

Thread th = new Thread(DoWrok);
th.Start(strList);

by

ThreadStart thrdStrt = new ThreadStart(methodName); //void method without parameters 
Thread th = new Thread(thrdStrt);
th.Start(params...);

Please debug your code to know where the problem is.

Ramy Mahrous 401 Postaholic Featured Poster

Paul... I didn't get where you stuck.. but if you need tutorial guide I recommend this http://functionx.com/adonet/index.htm

Ramy Mahrous 401 Postaholic Featured Poster

What type of database are you using?

Thread name SQL in C# :)

Ketsuekiame commented: Unconstructive. There are many types of SQL driven databases. +0
kvprajapati commented: N/A +10
Ramy Mahrous 401 Postaholic Featured Poster

I got yesterday a question how to get average date from list of dates, and here's my answer.

kvprajapati commented: definitely, sum of ticks. +10
Ramy Mahrous 401 Postaholic Featured Poster

Give me your connection string

Ramy Mahrous 401 Postaholic Featured Poster

Trust me, it works :) please mark it as solved.

Ramy Mahrous 401 Postaholic Featured Poster

created column index (delete button)

Ramy Mahrous 401 Postaholic Featured Poster

Post what you don't understand...

Ramy Mahrous 401 Postaholic Featured Poster

First create delete button in the grid

//I prefer to use the wizard to generate the delete button 
private System.Windows.Forms.DataGridViewButtonColumn Column1;
this.Column1.HeaderText = "delete";
            this.Column1.Name = "Column1";
            this.Column1.Text = "delete";
            this.Column1.UseColumnTextForButtonValue = true;
private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.ColumnIndex == 4)// created column index (delete button)
            {
                dataGridView1.Rows.Remove(dataGridView1.Rows[e.RowIndex]);
                //commit the changes!
            }
        }
Ramy Mahrous 401 Postaholic Featured Poster
Ramy Mahrous 401 Postaholic Featured Poster

Copy the code!! or make it reusable control and drag it and drop it wherever.

Ramy Mahrous 401 Postaholic Featured Poster

So, Daniweb administrative stuff can you please respond!

Ramy Mahrous 401 Postaholic Featured Poster

Because of spaces man...

public void WriteDataToFile(MeetingEntry currentEntry)
        {
            OleDbConnection dbConnection = new OleDbConnection(CONNECTION_STRING);
            
            string commandString =
            "INSERT INTO MeetingEntries (Subject, Location, [Start Date], [End Date], [Enable Alarm], [Repeat Alarm], Reminder, [Repetition Type])" + " VALUES (@Subject, @Location, @StartDate, @EndDate, @EnableAlarm, @RepeatAlarm, @Reminder, @RepetitionType)";
            //"INSERT INTO MEETINGENTRIES (SUBJECT, LOCATION, START DATE, END DATE, ENABLE ALARM, REPEAT ALARM, REMINDER, REPETITION TYPE)" + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
            
            OleDbCommand commandStatement = new OleDbCommand(commandString, dbConnection);
           

            commandStatement.Parameters.Add("Subject", OleDbType.VarWChar, 30).Value = currentEntry.Subject;
            commandStatement.Parameters.Add("Location", OleDbType.VarWChar, 50).Value = currentEntry.Location;
            commandStatement.Parameters.Add("StartDate", OleDbType.Date, 40).Value = currentEntry.StartDateTime.Date;
            commandStatement.Parameters.Add("EndDate", OleDbType.Date, 40).Value = currentEntry.EndDateTime.Date;
            commandStatement.Parameters.Add("EnableAlarm", OleDbType.Boolean, 1).Value = currentEntry.IsAlarmEnabled;
            commandStatement.Parameters.Add("RepeatAlarm", OleDbType.Boolean, 1).Value = currentEntry.IsAlarmRepeated;
            commandStatement.Parameters.Add("Reminder", OleDbType.Integer, 2).Value = currentEntry.Reminder;
            commandStatement.Parameters.Add("RepetitionType", OleDbType.VarWChar, 10).Value = currentEntry.Repetition.ToString();
            
            
            dbConnection.Open();
            commandStatement.CommandText = commandString;
            commandStatement.ExecuteNonQuery();
        }
Ramy Mahrous 401 Postaholic Featured Poster

please clarify or tell us the scenario...

Ramy Mahrous 401 Postaholic Featured Poster

From program.cs

/// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());//the name of the form :)      
}

Application.Run(new Form1());

Ramy Mahrous 401 Postaholic Featured Poster

So please attach here your application with the database, so I can help you better

Ramy Mahrous 401 Postaholic Featured Poster

It means the query run on Access database "INSERT INTO MeetingEntries (Subject, Location, Start Date, End Date, Enable Alarm, Repeat Alarm, Reminder, Repetition Type) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" which is wrong!

Ramy Mahrous 401 Postaholic Featured Poster
foreach(Control c in tableLayoutPanel1.Controls)
{
if( c is TextBox)
c.Text = null;
else if (c is CheckBox)
c.Checked = false;
else
//.....
}
Ramy Mahrous 401 Postaholic Featured Poster

Man! please read what I posted please commandStatement.CommandText in debug mode will show you the command gonna be executed! take it copy and paste in access and run it.

Ramy Mahrous 401 Postaholic Featured Poster

Please before commandStatement.ExecuteNonQuery(); get the commandStatement.CommandText and execute the query into access. see if it runs or not.

Ramy Mahrous 401 Postaholic Featured Poster

Can you please show us the exception?

or try currentEntry.EndDateTime.Date.ToShortDateString();

Ramy Mahrous 401 Postaholic Featured Poster

What do you mean by Clear the table layout? to reset all controls value i.e all textboxs Text property = null or to set the visibility = false
You can access all TableLayoutPanel controls by tableLayoutPanel1.Controls

Ramy Mahrous 401 Postaholic Featured Poster

To solve it and I assume taxableIncome is TextBox or Label

taxableIncome.Text = Convert.ToDouble(userValueTB.Text).ToString();
Ramy Mahrous 401 Postaholic Featured Poster

What's taxableIncome? please use code tags!
To solve second error

taxLBL.Text = Convert.ToDouble(taxLBL.Text).ToString();
Ramy Mahrous 401 Postaholic Featured Poster

I didn't completely figure it out but did you try this?

comboBox1.SelectedIndex = comboBox1.FindString("UserName");
Ramy Mahrous 401 Postaholic Featured Poster

Create table for recipe (name, description, avg. time to do it, how to make it etc..)
Create table form ingredients (name, etc..)
Create bridge table for both tables (DB concepts)
It's almost done!
Make a program to connect to this database search on (recipe name or recipe description) and show how to make it and some light logic.

You should thank your mom because she'll make you learn something new.

Ramy Mahrous 401 Postaholic Featured Poster

I don't like the sign... It should be visible by default not just when I over my mouse on someone profile picture!

Ramy Mahrous 401 Postaholic Featured Poster

Use AddRange method instead

ListBox2.Items.AddRange(ListBox1.Items);
kvprajapati commented: Solved! +9
Ramy Mahrous 401 Postaholic Featured Poster

Friend.. I can suggest another design

class User { 
//user properties, methods on the user instance
}
class UserCollection : IList<User> {
//users properties, methods on the users instance like add/remove...
}
Ramy Mahrous 401 Postaholic Featured Poster

Can you please move your thread to ASP.NET Forum to get lots of answers http://www.daniweb.com/forums/forum18.html

Ramy Mahrous 401 Postaholic Featured Poster

No excuses friend, I'm sorry as I couldn't help..

Ramy Mahrous 401 Postaholic Featured Poster

I can't test it with you as I have VS professional edition, if you allow me to use Team Viewer and access your machine I'll do, if you don't; then no problem.

Ramy Mahrous 401 Postaholic Featured Poster

dear it's another question :) please mark it as solved to help people find relevant threads.
Start new thread with another question.

Ramy Mahrous 401 Postaholic Featured Poster

Yes :)

Ramy Mahrous 401 Postaholic Featured Poster

So,
1- uninstall Report Viewer.
2- Reset the Visual Studio Environment http://www.platinumbay.com/blogs/dotneticated/archive/2007/09/02/reset-the-visual-studio-environment.aspx
3- Reinstall Report Viewer (please make sure that VS is 2008 and Report Viewer is 2008)

Feed me back :)

Ramy Mahrous 401 Postaholic Featured Poster

Select it then press the button... if you don't like to do it this way.. you may then replace selectedNode in my code with specific node.

Ramy Mahrous 401 Postaholic Featured Poster

If you're newbie.. please read in generics, arrays, and files
Generics http://msdn.microsoft.com/en-us/library/512aeb7t(VS.80).aspx
Arrays http://msdn.microsoft.com/en-us/library/aa288453(VS.71).aspx
File http://msdn.microsoft.com/en-us/library/system.io.file(VS.80).aspx

Ramy Mahrous 401 Postaholic Featured Poster

.mdt file?
please clarify your question...

Ramy Mahrous 401 Postaholic Featured Poster
Ramy Mahrous 401 Postaholic Featured Poster

use generics...

List<string> personsData = new List<string>();
string personData = "name,phone,number,postcode";
personsData.Add(personData);
//use System.IO.File class to store personsData content...
Ramy Mahrous 401 Postaholic Featured Poster

Do you see the ReportViewer control when you're trying to add them to the toolbox?

Ramy Mahrous 401 Postaholic Featured Poster

Add two buttons btnAdd, btnDelete.. create event handler (onClick) for both

private void btnAdd_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = treeView1.SelectedNode;
            selectedNode.Nodes.Add("New node"); //prompt it as textbox or by any way you see..
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = treeView1.SelectedNode;
            if (selectedNode.Parent == null)
                MessageBox.Show("Can't remove root node");
            else
                selectedNode.Remove();
        }