Ramy Mahrous 401 Postaholic Featured Poster

I expect they assume developer will write delete file code like this

public void DeleteFile(string filePath)
{
if(File.Exists(filePath))
File.Delete(filePath);
else
MessageBox.Show("File not exists, deleting file not performed");
//or throw an error message in their face
}
Ramy Mahrous 401 Postaholic Featured Poster

Some exceptions too
Exception Condition
IOException The specified file is in use.
ArgumentNullException path is null.
DirectoryNotFoundException The specified path is invalid, (for example, it is on an unmapped drive).
NotSupportedException path is in an invalid format.
UnauthorizedAccessException The caller does not have the required permission.-or- path is a directory.-or- path specified a read-only file.
ArgumentException path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
PathTooLongException The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.

Ramy Mahrous 401 Postaholic Featured Poster

Yes, it doesn't throw any exception if file not exists and they documented it.
Deletes the specified file. An exception is not thrown if the specified file does not exist.

public static void Delete(string path)
{
    if (path == null)
    {
        throw new ArgumentNullException("path");
    }
    string fullPathInternal = Path.GetFullPathInternal(path);
    new FileIOPermission(FileIOPermissionAccess.Write, new string[] { fullPathInternal }, false, false).Demand();
    if (Environment.IsWin9X() && Directory.InternalExists(fullPathInternal))
    {
        throw new UnauthorizedAccessException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("UnauthorizedAccess_IODenied_Path"), new object[] { path }));
    }
    if (!Win32Native.DeleteFile(fullPathInternal))
    {
        int errorCode = Marshal.GetLastWin32Error();
        if (errorCode != 2)
        {
            __Error.WinIOError(errorCode, fullPathInternal);
        }
    }
}

As you see it just checks if path is null or not and the permission.

Ramy Mahrous 401 Postaholic Featured Poster

First they should change project properties to use unsafe code from Project Properties window.

Ramy Mahrous 401 Postaholic Featured Poster

The similarity is existing.
And I don't know your level in C++, say you're advanced C++ programmer, so in 3 months you'll professionate C# and depends on the C# projects you are gonna develop.

Ramy Mahrous 401 Postaholic Featured Poster

It depends, excuse me, it's not a question. your question should be can I learn C# but the long time can't be determined.
Let me know when this question will be solved? when I say after 3 months :)
So, the answer is 3 months.

Ramy Mahrous 401 Postaholic Featured Poster

Yes, Danny, I begun to note that, the next coming days you'll find him asking a lot then no single thread to be marked as solved and even no replies.

Ramy Mahrous 401 Postaholic Featured Poster

What's the edition you are using + did you install server tools or client tools?

Ramy Mahrous 401 Postaholic Featured Poster

Evening, Danny :)
I didn't see your reply.

Ramy Mahrous 401 Postaholic Featured Poster

First please use Code tags.
Second, make class to handle this

class MyWord //may implement some interfaces
{
string word;
public string Word { get; set;}

int rank;
public int Rank { get; set;} 
}

Then when some search meets increase the rank.

Ramy Mahrous 401 Postaholic Featured Poster

Because you didn't take my code and just replace field1 with c, isn't it??
Surround second if with { }
Take my code copy and paste please.

private void FieldStore()
{
foreach (Control c in panel1.Controls)
{
if (c is TextBox)
if (c.Name == "field1")
{
c.Text = Area.Room1;
MessageBox.Show("This is Field1");
}
}
}
Ramy Mahrous 401 Postaholic Featured Poster

It works with me, do you work on Vista? if yes you run VS\your application as administrator.

Ramy Mahrous 401 Postaholic Featured Poster

What's this line field1.Text = Area.Room1; ??
Modify it to

private void FieldStore()
           {
               foreach (Control c in panel1.Controls)
               {

                   if (c is TextBox)
                       if (c.Name == "field1")
{
                           c.Text = Area.Room1;
                           MessageBox.Show("This is Field1");
}
               }
            
           }
Ramy Mahrous 401 Postaholic Featured Poster

You end users\stakeholders\clients must have SQLExpress formerly called MSDE (Microsoft SQL Server Desktop Engine). So you don't need to install SQL Server (Server tools).
Then how to attach the database there are a lot of ways to do it programtically may be through installation, may be standalone application do that work.
http://www.codeproject.com/KB/database/DBInstaller1.aspx

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

Please attach the project or show us the whole code which creating\searching the TextBox. and don't forget to surround it inside code tag.

Ramy Mahrous 401 Postaholic Featured Poster

You're welcome, just made sure it meets your need.

Ramy Mahrous 401 Postaholic Featured Poster

That's what you needed?? or it popup unneeded string?

Ramy Mahrous 401 Postaholic Featured Poster
String html = richTextBox1.Text;
            List<string> matches = new List<string>();
            Regex r = new Regex("href\\s*=\\s*(?:\"(?<1>[^\"]*)\"|(?<1>\\S+))", RegexOptions.IgnoreCase | RegexOptions.Compiled);
            Match m;// = r.Match(
            for (m = r.Match(html); m.Success; m = m.NextMatch())
            {
                matches.Add(m.Value);
                MessageBox.Show(m.Value);
                //new modified code
                //newGroups.Add(m.Groups[index]); //not 1 as you say
            }
farooqaaa commented: thanks man ~ farooqaaa +2
Ramy Mahrous 401 Postaholic Featured Poster

Can you please give me the link? to know what's this about.

Ramy Mahrous 401 Postaholic Featured Poster

No.

Ramy Mahrous 401 Postaholic Featured Poster

Excuse me Danny, Lighthead (Actually I don't know your real name).
Mansi please tell us your problem compilation error or fatal error in which line, etc.... it make that easier for us to help.

Ramy Mahrous 401 Postaholic Featured Poster

Sure it won't work as index not defined but what I need to say is you everytime add the same Group instance which in the index 1 of the array of Group.

Ramy Mahrous 401 Postaholic Featured Poster
String html = getSource();
List<Group> newGroups = new List<Group>();
r = new Regex("class=lnk href\\s*=\\s*(?:\"(?<1>[^\"]*)\"|(?<1>\\S+))", RegexOptions.IgnoreCase | RegexOptions.Compiled);
for (m = r.Match(html); m.Success; m = m.NextMatch())
{ 
      MessageBox.Show("Link" + m.Groups[1].Value); 
//new modified code
newGroups.Add(m.Groups[index]); //not 1 as you say
}

Read my comments in the code I may got you wrong.

Ramy Mahrous 401 Postaholic Featured Poster

May you have fun every minute you live, and I wish to see your post celebrating the 100th anniversary :)

Ramy Mahrous 401 Postaholic Featured Poster

My mistake, modify it to
== instead of =

foreach(Control c in Panel1.Controls)
{
if(c is TextBox)
if(c.Name == "field1") //or any property c.Text == "" or c.....
MessageBox.Show(string.Format("TextBox Name: {0} , TextBox Text {1}",c.Name, c.Text));
}
Ramy Mahrous 401 Postaholic Featured Poster

If you know anything about it. Its Text or its Name you can add a condition

foreach(Control c in Panel1.Controls)
{
if(c is TextBox)
if(c.Name = "field1") //or any property c.Text = "" or c.....
MessageBox.Show(string.Format("TextBox Name: {0} , TextBox Text {1}",c.Name, c.Text));
}
Ramy Mahrous 401 Postaholic Featured Poster

Here's a post I wrote but it's by C# you can see the idea and convert it to VB.NET http://fcihelwan.wordpress.com/2008/05/16/how-to-make-your-controls-moveable/

Ramy Mahrous 401 Postaholic Featured Poster

You're welcome my friend, Danny
I Hope it solves their problem.

wingers1290 commented: Brilliant +1
Ramy Mahrous 401 Postaholic Featured Poster
foreach(Control c in Panel1.Controls)
{
if(c is TextBox)
MessageBox.Show(string.Format("TextBox Name: {0} , TextBox Text {1}",c.Name, c.Text));
}
ddanbe commented: Nice snippet! +7
Ramy Mahrous 401 Postaholic Featured Poster
Ramy Mahrous 401 Postaholic Featured Poster

No, Serkan it also used as they said in desktop application SQL Server Compact 3.5 is a free, easy-to-use embedded database engine that lets developers build robust Windows Desktop and mobile applications that run on all Windows platforms including Windows XP, Vista, Pocket PC, and Smartphone. read more

You're both right everyone has another piece of information.

Ramy Mahrous 401 Postaholic Featured Poster

@Lighthead
You're welcome.
Nothing called stupid, you're trying to help and you should be thanked.
Nice to have you around and trying to help others.

lighthead commented: Nice piece of code. +2
Ramy Mahrous 401 Postaholic Featured Poster

@Scott

In this class file i created an instance of "Card" structure successfully as shown in above code. But i cannot access the properties of structure like this(as shown bleow):

i created an instance of "Card" structure successfully as shown in above code
I bet there's no problem, I believe they have problem in something else.

Ramy Mahrous 401 Postaholic Featured Poster

Ema005 who said it's private the default is internal and it's!, and they can use it in the same assembly.
I take the code and run it, no problem.

Ramy Mahrous 401 Postaholic Featured Poster

You've something wrong it should work right.

Ramy Mahrous 401 Postaholic Featured Poster

What the at runtime created controls? TextBoxes or Buttons ?
If TextBoxes
You can add reference to recent created textbox name and perform the calculation
I.e: We created textbox its name textbox15

string recentTextBoxName = GetRecentCreatedTextBox();
string GetRecentCreatedTextBox()
{
///creating textbox at runtime
///return its name
}
void PerformCalcualtion(string textBoxName)
{
foreach(Control c in Controls)
if(c is TextBox)
if(c.Name == textBoxName)
//perform calculation on c
}

If buttons
when you create button assign a handler to it

///initialize controls properties
button1.Click+=new EventHandler(button_Click);
button2.Click+=new EventHandler(button_Click);
button3.Click+=new EventHandler(button_Click);

void button_Click(object sender, EventArgs)
{
///some code
}
Ramy Mahrous 401 Postaholic Featured Poster

Create project from type VC++ and add its output assembly to C# project. I'm using VSTS 2008 which permits that, I don't know what version you're talking about.

Ramy Mahrous 401 Postaholic Featured Poster

I don't know where your problem actually in, but if you succeed to develop application in C# to take backup then you may turn into MySQL forum to ask about anything related to MySQL

Ramy Mahrous 401 Postaholic Featured Poster

He can also add in splitters what you need
It may be also array of string to have something like that ("\r\n") if you read from text files.

Ramy Mahrous 401 Postaholic Featured Poster

It's up to you, all end with the skills you can grow them up, if you're smart you'll do anything by anything.
But I should say something C# is full of features and I like it, the most programming language has community based solution. That's my opinion personal opinion.

Ramy Mahrous 401 Postaholic Featured Poster

I think they need to have Label and scroll its contents.
Please answer us.

Ramy Mahrous 401 Postaholic Featured Poster

Need to export MySQL database to ??
I recommend you to use SQL Server Integration Services
P.S: Destination ought not to be MS SQL Server.

Ramy Mahrous 401 Postaholic Featured Poster

To get word by word then search on specific word

int GetWordIndex(string word)
{
char[] splitters = new char[]{' '};
string[] wordsArr = RichTextBox1.Text.Split(splitters, StringSplitOptions.RemoveEmptyEntries);
for(int i=0; i< wordsArr.Length; i++)
if(string.Equals(wordsArr[i], word, StringComparison.InvariantCultureIgnoreCase))
return i;
return -1; //indicates there is no match
}
sknake commented: ramy got it again! +4
Ramy Mahrous 401 Postaholic Featured Poster

Go ahead :)

Ramy Mahrous 401 Postaholic Featured Poster

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx

using (SqlBulkCopy bulkCopy =
                           new SqlBulkCopy(destinationConnection))
                {
                    bulkCopy.DestinationTableName =
                        "dbo.BulkCopyDemoMatchingColumns";

                    try
                    {
                        // Write from the source to the destination.
                        bulkCopy.WriteToServer(reader);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                    finally
                    {
                        // Close the SqlDataReader. The SqlBulkCopy
                        // object is automatically closed at the end
                        // of the using block.
                        reader.Close();

///LOG THE SUCCESS\ FAILURE OF THE OPERATION
                    }
                }
Ramy Mahrous 401 Postaholic Featured Poster

Use Setup wizard project to create an package for installation.

Ramy Mahrous 401 Postaholic Featured Poster

You'll need to play with DataBound Event Handler, read this post http://www.csharphelp.com/archives/archive151.html and try to apply the concept on your case
Google result: http://www.google.com.eg/search?rlz=1C1CHMB_enEG312EG313&sourceid=chrome&ie=UTF-8&q=databound+grid+combobox+C%23

Ramy Mahrous 401 Postaholic Featured Poster

Please use code tag :)

static void Main(string[] args)
{
//code to call the method Getnames and print the value of name here..
Demo d = new Demo();
List<MyTest> m = new List<MyTest>();
d.GetNames<MyTest>(m);            
}
Ramy Mahrous 401 Postaholic Featured Poster

Please clarify what's your project what did you do by your hand and what components you'll use, because I've nor experience about developing web browsing applications