Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

Mohamad Al Husseiny

@Mohamad Al Husseiny
About
Posts
288
Topics
8
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Windows API(kernel)
    M Mohamad Al Husseiny

    look at [Hooking the native API and controlling process creation on a system-wide basis](<a href=) [^]" rel="nofollow"> MCAD -- modified at 12:59 Wednesday 4th January, 2006

    C# csharp com json help

  • Determine if a thread has been instantiated
    M Mohamad Al Husseiny

    You can write some thing like the following

     if(t != null)
       {
          t.Start();
       }
    

    MCAD

    C# question

  • Insert table into a RichTextBox
    M Mohamad Al Husseiny

    AFIK There are no out of the box method you need to deal with RTF syntax to do this look at RTF [^] MCAD

    C# question

  • How can I ?
    M Mohamad Al Husseiny

    You need to handel Command Line Arguments in Your program So use public static void Main(string Args[]) Or static int Main(string[] Args) instead of parametersless Main method look at Command-Line Arguments[^] you need to parse this arguments to handle more complex parameters an example for this can be found at C#/.NET Command Line Arguments Parser [^] MCAD -- modified at 20:59 Thursday 6th October, 2005

    C# question json help

  • Is there collection object in C# .NET?
    M Mohamad Al Husseiny

    Use HashTable look at HashTable Class[^] For more Info MCAD

    C# csharp dotnet question

  • How to get an array of Pens in a user defined class to &quot;work&quot; in a WinForm?
    M Mohamad Al Husseiny

    You wrote Anonymous wrote: Pen p = GetNextPen(); this will generate The name 'GetNextPen' does not exist in the class or namespace 'ComplexTest2.Form1' error because the compiler will think GetNextPen() member of Form and this not true because it is a member of complex2 and you didn't call it from an object of this class Anonymous wrote: Even if I try this: g.DrawLine(cmplxValue1.GetNextPen()....) the instantiated object doesn't "see" the method... please help thanks a lot.... are you replaced all places you call this function or gust this line? you need to replace all the places like Pen p = GetNextPen(); too MCAD -- modified at 1:01 Thursday 6th October, 2005

    C# graphics help data-structures tutorial question

  • Graph vertex edge weights
    M Mohamad Al Husseiny

    look at An Extensive Examination of Data Structures Part 5: From Trees to Graphs[^] and other parts MCAD

    C# csharp visual-studio com data-structures tutorial

  • COM and COM+ in C#
    M Mohamad Al Husseiny

    You Can Create COM+ Application in .Net By Create your dll and inherit your class from ServicedComponent and assign Your assembly and each of its classes with distinct GUID values by using the Guid attribute if you don't give it guide value it in the following assembly registeration will assign one for each element But as you now Com+ undersatnd COM not .Net Component so to let other COM Client Find and Use your component you need to register your .Net Component as COM Server in Windows Registry This process called Asssembly Registration 1-sign a .NET assembly using the Strong Name tool (sn.exe). 2-Register your assembly You can do it by more than one way for example in your Project Properties change Register for COM Interop option to true or Use the Assembly Registration tool regasm.exe for more info look at Creating COM+ Objects using EnterpriseServices in .NET [^] COM/COM+[^] ServicedComponent Class[^] To Export your Component As COM Type Libraries You Can use the tools mentioned above but notice that you don not have to inhiret from ServicedComponent ie 1-Create Your Component 2-Export it as Type Lib By Using one of the following tools *-In Project Properties Set Register for COM Interop option to true *- Use the Assembly Registration tool (regasm.exe) with its /tlb option *-Use the Type Library Exporter tool (tlbexp.exe) MCAD -- modified at 14:52 Thursday 29th September, 2005

    C# csharp com tutorial

  • C# newbee
    M Mohamad Al Husseiny

    So do you want IE to host your application or you want yor application to run IE? I think you mean the first so suggest to use web app can you give more details? MCAD

    C# csharp design

  • C# newbee
    M Mohamad Al Husseiny

    why not create asp.net application instead of windows forms app MCAD

    C# csharp design

  • Which is efficient? &quot;&quot; or string.Empty ?
    M Mohamad Al Husseiny

    May be this helpString.Empty vs "" [^] MCAD

    C# question

  • How to reach an object that dont have name
    M Mohamad Al Husseiny

    the m object not accessable outside button1_Click at all even if they have separate name because its scope so you need to store them like other response suggest and access them later by index or by key depending on the collection type MCAD

    C# tutorial performance help question

  • draw inside an abject
    M Mohamad Al Husseiny

    At general to customize the drawing of control you drive your class from it and override OnPaint but not al controls easy for customization like others to look at code do what you want look at Tile a Bitmap Into a TextBox Background[^] it is in VB6 but you can get some ideas from it MCAD

    C# tutorial

  • Use of java script in asp.net pages
    M Mohamad Al Husseiny

    There are many ways you can use Javascript in your asp.net ASP.Net come with some validation of controls did you looked to them if no one of them have what you need you can use CustomValidator control and write your javascript for validating the control for example look at Allowing Only Numbers in ASP. NET TextBoxes[^] If You want to call JavaScript code when you click Button for example you can write somthing like Button1.Attributes.Add("onClick","DoIt();"); this allowed DoIt script function to be called when the user click the Button or write the code directly like Button1.Attributes.Add("onClick","alert('Test Test');"); MCAD -- modified at 21:30 Friday 23rd September, 2005

    C# csharp java asp-net tools help

  • Listing Database Names
    M Mohamad Al Husseiny

    SqlServer have sp_databases Stored Procedure which list databases available in the server instance you can write somthing like

    private void ListDatabases_Click(object sender, System.EventArgs e)
    {
    using(SqlConnection cn=new SqlConnection("Server=localhost;Initial Catalog=master;Integrated Security=SSPI;"))
    {
    	cn.Open();
    	SqlCommand cmd=new SqlCommand("sp_databases",cn);
    	cmd.CommandType=CommandType.StoredProcedure;
    	SqlDataReader dr=cmd.ExecuteReader();
    	while(dr.Read())
    	{
    		Debug.WriteLine(dr.GetString(0));
    
    	}
    	dr.Close();
    	cmd.Dispose();	
    
    }
    
    }
    

    MCAD -- modified at 21:43 Friday 23rd September, 2005

    C# database sql-server sysadmin question

  • C# Sucks!
    M Mohamad Al Husseiny

    To Browse for files use OpenFileDialog you will find it in the toolbox after that ypu can write some thing like

    openFileDialog1.InitialDirectory = "c:\\" ;
    openFileDialog1.Filter = "CSharp files (*.cs)|*.cs" ;
    if (openFileDialog1.ShowDialog() == DialogResult.OK)
        {
           // do your work here
           //OpenFileDialog have properties and method that    wil let yo work with file like get file name,opern it..etc
    
        }
    For More info look at OpenFileDialog Class[^]
    

    If you really missed Windows API Function that you did not find counterpart in .Net You can use it By using P/Invoke which let you call function in traditional dll look for Using P/Invoke to Access Win32 APIs[^] MCAD

    C# csharp c++ visual-studio json tutorial

  • What message is called when the X in the upper right of a dialog is closed
    M Mohamad Al Husseiny

    The Windows recive WM_SYSCOMMAND Notification when you close minimize or maximize the window or you choose any command from the system menu So overrid your form WndProc function and handle it

    const int WM_SYSCOMMAND  = 0x0112;
    const int SC_CLOSE    =    0xF060;
    

    protected override void WndProc(ref Message m)
    {
    if(m.Msg==WM_SYSCOMMAND)
    {
    if(m.WParam.ToInt32()==SC_CLOSE)
    {
    MessageBox.Show("Application will be close");
    // call the default after you handle it
    base.WndProc(ref m);
    }
    }
    else
    {
    base.WndProc (ref m);
    }
    }

    if you don not handle other Message you can write it like

    protected override void WndProc(ref Message m)
    {
    if(m.Msg==WM_SYSCOMMAND)
    {
    if(m.WParam.ToInt32()==SC_CLOSE)
    {
    MessageBox.Show("Application will be close");
    }

    }
        base.WndProc (ref m);
    

    }

    for more information look at WM_SYSCOMMAND Notification[^] MCAD -- modified at 18:53 Friday 23rd September, 2005

    C#

  • porting c# aplplications to linux
    M Mohamad Al Husseiny

    http://www.mono-project.com/FAQ:_General[^] Introduction to Mono - Your first Mono app [^] MCAD

    C# csharp linux question

  • Accessing embedded text box scroll bars
    M Mohamad Al Husseiny

    good you found the solution this was what i will suggest if you didn't found the solution to override WndProc and catch WM_VSCROLL so this only solution i know MCAD

    C# csharp hardware tutorial question

  • Grab Text From Other Window
    M Mohamad Al Husseiny

    If You use RichTextBox you can use GetCharIndexFromPosition to get the word this simple example

    private string GetWordFromPos(Point p)
    {
    	string word;
    	int cIdx=richTextBox1.GetCharIndexFromPosition(p);
    	//go left
    	int startPos;
    	for(startPos=cIdx;startPos>0;startPos--)
    	{
    		string c=richTextBox1.Text.Substring(startPos-1,1);
    		if(c == " ") // add more seperator check here
    			break;
    	}
    	//get the left part
    	word=richTextBox1.Text.Substring(startPos,cIdx-startPos);
    	//go right
    	for(startPos=cIdx;startPos
    

    If you use `TextBox` then `TextBox` didn't have equivalent method or as i know so you need to use `SendMessage` Windows API to Function to send `EM_CHARFROMPOS` to get the index of the Char and Modify the previous function to take to get the text for more inf o look at [EM_CHARFROMPOS Message](http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/editcontrols/editcontrolreference/editcontrolmessages/em_charfrompos.asp) [[^](http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/editcontrols/editcontrolreference/editcontrolmessages/em_charfrompos.asp "New Window")] MCAD -- modified at 22:30 Tuesday 13th September, 2005

    C# csharp dotnet json tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups