16,016,562 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge Â
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Engineer khalid (Top 111 by date)
Engineer khalid
4-Feb-24 10:41am
View
i added 3.1415 as a word the count increased by two not by one
may be i need to add some thing to
int WordCount = Regex.Matches(text, @"\b[A-Za-z0-9]+\b").Count;
the above line seems to ask for all words from A to Z and From a to z and numbers from 0 to 9
how can i cover float numers , number that start by + or minuse signe (i almost forgot most of pure c language)
Engineer khalid
7-Jan-24 18:17pm
View
ok
Engineer khalid
7-Jan-24 17:01pm
View
Deleted
public class Cv
{
public Ch[] sunof_cv;
private int icv;
public Cv() { }
public Cv(int Xicv)
{
ICV = Xicv;
}
public int ICV { get { return icv; } set { icv = value; } }
public Ch this[int i] { get { return sunof_cv[i]; } set { sunof_cv[i] = value; } }
}//Cv
//
public class Bv
{
public Bh[] sunof_bv;
private int ibv;
public Bv() { }
public Bv(int Xibv)
{
IBV = Xibv;
}
public int IBV { get { return ibv; } set { ibv = value; } }
public Bh this[int i] { get { return sunof_bv[i]; } set { sunof_bv[i] = value; } }
}//Bv
public class Ch
{
private int ich;
public Ch() { }
public Ch(int Xich)
{
ICH = Xich;
}
public int ICH { get { return ich; } set { ich = value; } }
}//Ch
public class Bh
{
public Ch[] sunof_bh;
private int ibh;
public Bh() { }
public Bh(int Xibh)
{
IBH = Xibh;
}
public int IBH { get { return ibh; } set { ibh = value; } }
public Ch this[int i] { get { return sunof_bh[i]; } set { sunof_bh[i] = value; } }
}//Bh
public class Ah
{
public Bh[] sunof_ah;
private int iah;
public Ah(){ }
public Ah(int Xiah)
{
IAH = Xiah;
}
public int IAH { get { return iah; } set { iah = value; } }
public Bh this[int i] { get { return sunof_ah[i]; } set { sunof_ah[i] = value; } }
}//Ah
Engineer khalid
7-Dec-23 6:13am
View
may be the end character of files[i] is not \n
look at this
string[] mystr=new string[50];
i still could not save files[0],files[1],files[2]....so on
to
for(i=0;i<3;i++)//assume we have only 3 files
mystr[i]=files[i];
Engineer khalid
7-Dec-23 1:21am
View
i should get all file names in the text file ListOfFileName.txt
but i found it is empty
Engineer khalid
7-Dec-23 1:16am
View
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace testGetFile
{
public partial class Form1 : Form
{
FileStream fs, fg;
StreamWriter sw;
protected override void OnClosing(CancelEventArgs e)
{
if (sw != null) sw.Close(); if (fg != null) fg.Close();
}
//--------------------------------------------------------
public Form1()
{
InitializeComponent();
}
//------------------------------------------------------
private void btnStartClick(object sender, EventArgs e)
{
int i, Nfile = 0;
string CurrentDirectory = "";
string[] iFile = new string[50];
for (i = 0; i < 50; i++) iFile[i] = "";
CurrentDirectory = Directory.GetCurrentDirectory();
//**********************************************************
fg = new FileStream("ListOfFileName.txt", FileMode.Truncate, FileAccess.Write);
StreamWriter sw = new StreamWriter(fg);
//----------------------------------------------------------
string[] files = Directory.GetFiles(CurrentDirectory);
i = 0;
Nfile = 0;
foreach (string file in files)
{
MessageBox.Show(file);
Nfile++;
}
for (i = 0; i < Nfile; i++)
{
iFile[i] = files[i];
sw.WriteLine(iFile[i]);
}
}//btnStartClick
}
}
Engineer khalid
6-Dec-23 8:17am
View
i need to store the file names to an array and send them to a text file like this
sw.WriteLine(file[i]); // <=== it did not works
Engineer khalid
30-Oct-23 12:26pm
View
More information about the ms word 2013
by right clicking on ms word icon then selecting shortcut from upper tab menue then selecting advanced i see 2 checked boxes
a text beside the check box 1 (unchecked)sayes run as an administrator
this allows you to run this shortcut as an administrator,while protecting your computer from unauthorized activity.
the other text beside check box2 (its status checked)sayes
run in separate memory space
i could not change any checkbox
Engineer khalid
30-Oct-23 12:03pm
View
i change the cpu to x64 and run the program i got same error
then
i shift to (x86) that is 32bit and rerun program i got same error
Engineer khalid
24-Sep-23 6:16am
View
Great looks good example
Engineer khalid
24-Sep-23 6:04am
View
Deleted
//i used to do this
public static int x;//in Form1
//may be in my case i use
public static int[] x;
Engineer khalid
24-Sep-23 5:56am
View
Deleted
this is what i used to do
public static int x;//in Form1
//or
public static int[] x;//in Form1
would you provide link to any example i have never done some think like this,i am an engineer not a programer my time is distracted between them
Engineer khalid
5-Sep-23 7:00am
View
whatsapp need "%0a" for new line .
to find number of lines in richBox1 use Nline = richTextBox1.Lines.Count();
empty line in richTextBox1 considerd as a line.Those things added more bug to code
Engineer khalid
5-Sep-23 6:42am
View
u are right it was not the solution
i found the solution give me some time (about 30 minutes )to review it
Engineer khalid
4-Sep-23 15:59pm
View
the above code send 3 lines to whatsapp but whatsapp receive it and accept it as one line
if somebody solve this issue ?
Engineer khalid
4-Sep-23 15:49pm
View
i beleive whatsapp will not accept \r\n for new line it concacnate all 3 lines in one single line
i will post the whole program here may be somebody solve it
Engineer khalid
4-Sep-23 11:31am
View
Deleted
.
Engineer khalid
31-Aug-23 11:53am
View
i have tried and tried ...please help
Engineer khalid
31-Aug-23 11:49am
View
The question now is improved with more detail
program run ok when
public string[][][] BILLNAME
{
get { return billname; }
set { billname = value; }
}
Engineer khalid
28-Aug-23 6:05am
View
i used binaryWriter and BinaryReader instead .it seems i will have a question about class size ,i might post it later
Engineer khalid
31-Jul-23 3:40am
View
If computer set to different language like arabic the format of dat will be dd\mm\yyyy not mm\dd\yyyy
if the date 1\1\2023 for example it would be impossible to know which one is day and which one is month.i want to save the date of the system in string then try to set the date to 1\13\2023 if i catch then the format is dd\mm\yyyy if not it should be mm\dd\yyyy then i soon reset the date back, my goal is to know the date format of the user computer
if there is away to know the type of format (using Bios or any method) let me know.
Many thanks
Engineer khalid
3-Jul-23 8:30am
View
i rated the answer as 5 but i can see only 3 lightting stars,you desirve 5 any way
Engineer khalid
21-May-23 5:08am
View
I want to do some code with thread together with delegate.it is good to subscribe function and call it from loop, but now I realized that both the vv and thrd are equally subscribed so this is useless. Errors are close to the programmer’s. I will quit the question
thank you for your patient
Engineer khalid
20-May-23 22:29pm
View
I fixed the sample code
Engineer khalid
20-May-23 9:59am
View
to me the equal signe in declaration of thread function is a mystery
Thread function must return SampleDelegate i have no idea how to return a SampleDelegate which it is
System. Threading. ThreadStart
For example If int i can write return(0);
i have spent many hours today and yestrday searching in the net but failed .please if you know the answer and i am sure you know ,kindly write it to me
accept my thanks to from overseas
Engineer khalid
20-May-23 9:11am
View
parallel - and - asynchronous - programming -in-csharp is interresting i have seen several computer connected together
working as a supper computer however i have to finished my program. working with thread is new subject for me
and it will be good advise to select Asynchronous thread among others
this is what i have done to my code
declaration changed to
delegate System.Threading.ThreadStart SampleDelegate(int i);
and allocation for thread becomes
thrd[i] = new Thread(new ThreadStart(vv[i](j)));//<==no error
i have error in
SampleDelegate runThread_0 = delegate (int jj) { MessageBox.Show("jj=", jj.ToString()); };
SampleDelegate runThread_1 = delegate (int jj) { MessageBox.Show("jj=", jj.ToString()); };
studio error is
Not all code paths return a value in anonymous method of type 'Form1.MyClass.SampleDelegate'
i still need help
Engineer khalid
27-Jan-23 1:44am
View
i gave you 5 star grade but i can see only the 1st left star and part of the second one activated
Engineer khalid
27-Jan-23 1:40am
View
the 1st solution did not worked but the other works fine
Engineer khalid
12-Aug-22 11:47am
View
yes i am he same person that posted Need to subscripe mousedown[^]? but the previous question was for one dimension and was solved but now for 2 dimension i got another error.
you wrote "delete the duplicate userid."
ok i am will to delete but would you please explain what you ment by userid do you mean this question ?
Engineer khalid
12-Aug-22 11:36am
View
if one dimension
i have 2 picturebox when the cursor enter the 1st pictureBox and button is pressed it calls the
event mouseDown named pb1MouseDown using the delegate MyFun[0],same thing if the mousedown pressed when it in pictureBox2 it calls MyFun[1] or pb2MouseDown
i selected delegate rather than the unsafe pointer to function
--
i expect two dimension delegate can be easly done by changing to
SampleDelegate[][] MyFun = {
{ pb00MouseDown, pb01MouseDown },
{ pb10MouseDown, pb11MouseDown }
};
but it did not works
Engineer khalid
12-Aug-22 11:18am
View
if you need the whole (small) program i will write here
Engineer khalid
12-Aug-22 11:16am
View
The error says
"array initializer can only be used in variable or field initializer. try using anew expression instead"
i have no problem when it is one dimension like this code
SampleDelegate[] MyFun = { pb1MouseDown, pb2MouseDown };
MyFun[0](sender, (MouseEventArgs)e);
Engineer khalid
28-Jan-22 11:40am
View
480384 is the size used
i should read more in memory,still waitting for help
Engineer khalid
28-Jan-22 11:15am
View
i am not sure about this
static void Main()
{ int count;
long memBefore = GC.GetTotalMemory(true);
Console.WriteLine("memBefore = {0}\n", memBefore.ToString());
Console.ReadLine();
}
i get memBefore = 480384
Engineer khalid
28-Jan-22 10:51am
View
MemoryStream memStream = new MemoryStream(X);
I guess I am looking for this value X.
may be some thing like memStream.bufferMaxSize
Engineer khalid
23-Jan-22 4:09am
View
it works after i changed to the click to the pictureBox1 ,there was another hidden error it was missing one jpg file
i do not know how to thank you
my pleasure
Engineer khalid
23-Jan-22 3:49am
View
i have a run time error ,constructer has no problem but this line
ClassPictureBox1.Image = Image.FromFile("cat.jpg");//line C
Engineer khalid
23-Jan-22 3:31am
View
Deleted
i have a run time error at this line
ClassPictureBox1.Image = Image.FromFile("cat.jpg"); //line C
no error in class constructer
Engineer khalid
23-Jan-22 2:37am
View
Thank you for your long answer and patent.
please have a look at the updated code above search for line A and line B.
one line is commented and another were un commmented
i made RunThreadClick from the picturebox1 not from button but still did not works
Engineer khalid
28-Nov-21 10:31am
View
The following comment might help other member who might fall into this kind of problem
it also worth to keep this note in my page .I might forget it after some time
I am codding a program that read and explain (in sound) a program for pic (assembly) all Register has to be positive(as far as i know) so i initialize all register to negative (-1) if however the user did not initialize the register that means its value is negative (-1) so i intercept that in
if(Register==-1) MessageBox.Show("Error","the register "+register+" must be initialized");
Engineer khalid
28-Nov-21 9:51am
View
look at this c++ code
int x,*p,**q;
x=10;
p=&x;//address of x is saved in pointer p
q=&p;//the value in the pointer p (means the value of x ) is saved in q
// so the following line is worth to try
if(q !=null) continue;
could i attach the c++ code above in my c sharp code ?
or
could any one translate the c++ code above to c sharp ?
Engineer khalid
4-Oct-21 1:25am
View
that was my 1st wpf program
i will use the program below...thanks any way
Engineer khalid
27-Aug-21 13:46pm
View
microsoft.windowsAPiCodePack.Shell
can be doawnload from this site
https://www.nuget.org/packages/Microsoft-WindowsAPICodePack-Shell/
i still waitting for the other part of the question(mciSendString)
Engineer khalid
23-Aug-21 10:42am
View
i moved the thread from formload to the class .it works
Engineer khalid
4-Aug-21 7:21am
View
thanks
this.pnl.Anchor= (AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top);
Engineer khalid
30-Oct-19 8:01am
View
thank you very much
Engineer khalid
1-May-19 12:36pm
View
Good alternative... my appreciation
Engineer khalid
24-Apr-19 7:58am
View
note i have confirmed my email and accepted the solution with grad 5 thanks
Engineer khalid
24-Apr-19 7:50am
View
the above solution was good it help me found the problem the following detail will help too
ListBox lbSender = (ListBox)sender;
if (lbSender == lb && (e.State & DrawItemState.Selected) != DrawItemState.Selected )
{ //draw the item}
else if (lbSender == lb && (e.State & DrawItemState.Selected) == DrawItemState.Selected)
{// change the color of the selected item}
Engineer khalid
24-Apr-19 2:41am
View
i have no knowldge in wpf/ UWP / XAML.
i have improved the question just now...
Engineer khalid
29-Mar-19 9:21am
View
i bought ip camera and i am not willing to buy another diffrent brand unless it satisfy my desire .... i need from any one to tell me which one can works with free dynamic dns(e mail me). i am not allowed to post the brand name of my camera(not sure)
Engineer khalid
29-Mar-19 8:31am
View
sorry the above comment is for any one
Engineer khalid
29-Mar-19 8:23am
View
To Richard MacCutchan . i wish if you mail me the camera brand name which can operate using free dynamic dns . nither the manufacture of the camera that i have bought nor their dealer did not reply to my question( iamegrk@gmail.com)
Engineer khalid
29-Mar-19 7:51am
View
u wrote i need a fixed IP address ,ok i think there are 2 choices .
An IP static
or
a free dynamic dns. is there is a camera that can works using the free dynamic dns ?
if yes i can avoid buying a static ip (i will choice any camera that will works on a free dynamic dns)
Engineer khalid
16-Apr-18 14:45pm
View
still not compiled
Engineer khalid
16-Apr-18 14:44pm
View
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace test
{
partial class Form1 : Form
{
public static FileStream fsG; StreamWriter sg;
class MyNum
{
private int x;
public MyNum() { }
public MyNum(int Xx) { X = Xx; }
public int X { get { return x; } set { x = value; } }
}//MyNum
class Sun
{
public int n;
public MyNum[] V;
public Sun() { }
public Sun(int Xn) { N = Xn; }
public int N { get { return n; } set { n = value; } }
public MyNum this[int i]
{ get { return V[i]; } set { V[i] = value; } }
}//MyLine
class father
{
public int x;//Number to be analysed like 256,128,64
public Sun[] P;
public father() { }
public father(int Xx) { X = Xx; }
public int X { get { return x; } set { x = value; } }
public Sun this[int i] { get { return P[i]; } set { P[i] = value; } }
}//father
static public father[] xx = new father[3];
public Form1() { InitializeComponent();}
//------------------------------------------------
private void FormLoad(object sender, EventArgs e)
{int i,j,k;
fsG = new FileStream("Tracey.txt", FileMode.Truncate, FileAccess.Write);
sg = new StreamWriter(fsG);//, System.Text.Encoding.Default);//for arabic file);
for (i = 0; i < 3; i++)// TO ANALYSE 3 NUMBERS like 256, 128 64
{
xx[i] = new father();//3 father
xx[i].X = 0;
xx[i].P = new Sun[4];//each father has four suns
for (j = 0; j < 4; j++)
{
xx[i].P[j] = new Sun(); //NUM,DIV,FACT,POWER each one has N which indicate how many NUM or DIV or FACT POWER
xx[i].P[j].N = 50; //each sun has 50 child
xx[i].P[j].V = new MyNum[50];//xx[i].P[j].N];//50 child
for (k = 0; k < xx[i].P[j].N; k++)
{
xx[i].P[j].V[k] = new MyNum();
xx[i].P[j].V[k].X = k;//each child has number`
}
}//j
}//for i
}
private void button1_Click(object sender, EventArgs e)
{
int i, j,k;
for (i = 0; i < 3; i++)// TO ANALYSE 3 NUMBERS
{
sg.Write("xx["+i.ToString()+"]="+"\r\n");
for (j = 0; j < 4; j++)
{
sg.Write("xx[" + i.ToString() + "].P[" + j.ToString() + "].N=" + xx[i].P[j].N.ToString()+"\r\n");
for (k = 0; k < 50; k++)
{
xx[i].P[j].V[k].X = k;
sg.Write("xx[" + i.ToString() + "].P[" + j.ToString() + "].V[" + k.ToString() + "].X=" + xx[i].P[j].V[k].X + "\r\n");
}//for k
}//j
}//for i
sg.Close(); fsG.Close();
MessageBox.Show("end");
}
Engineer khalid
16-Apr-18 14:31pm
View
Deleted
//those lines are in form1_Load
for (i = 0; i < 3; i++)// TO ANALYSE 3 NUMBERS like 256, 128 64
{
xx[i] = new father();//3 father
xx[i].X = 0;
xx[i].P = new Sun[4];//each father has four suns
for (j = 0; j < 4; j++)
{
xx[i].P[j] = new Sun(); //NUM,DIV,FACT,POWER each one has N which indicate how many NUM or DIV or FACT POWER
xx[i].P[j].N = 50; //each sun has 50 child
xx[i].P[j].V = new MyNum[xx[i].P[j].N];//50 child
for (k = 0; k < xx[i].P[j].N; k++)
{
xx[i].P[j].V[k] = new MyNum();
xx[i].P[j].V[k].X = k;//each child has number`
}
}//j
}//for i
still it did not compiled
i might post the complete program if you want its short
Engineer khalid
20-Mar-18 7:36am
View
do i need hardware other than the internetcard ?
Engineer khalid
20-Mar-18 7:35am
View
one big mistake i made console program in windowform !the program in msdn looks good
i need hint
should i connect the two computers using wire or wirless ?
Engineer khalid
20-Mar-18 3:32am
View
i tried to connect one computer(window 7) and another computer using window 10 on wirless net and i wrote an ip address in both computer
(same address) ,still does not work
then i connect both computer useing cat6 cable and lan net still does not works
Engineer khalid
9-Mar-18 6:54am
View
Deleted
hellow again
i have just found the address of the ipcamera it is 192.168.1.64
should i add /jpg/image.jpg to have the address looks like
192.168.1.64/jpg/image.jpg
Engineer khalid
9-Mar-18 6:54am
View
Deleted
hellow again
i have just found the address of the ipcamera it is 192.168.1.64
should i add /jpg/image.jpg to have the address looks like
192.168.1.64/jpg/image.jpg
Engineer khalid
9-Mar-18 5:57am
View
hello Maciej Los ,i saw your name in my question about ipcamera with a button Reply beside it,frankly i do not know what does that mean Codeproject has updated their Site. i still need help regarding how to know the correct address about ipcamera
Engineer khalid
9-Mar-18 5:40am
View
I appreciate the help,for the time being i have only 1 network .
1- Is it possible for the ip camera to work using 1 network (my location now has only
one network)
2- Does my program seems to work (the only error is uncorrect ip address)
3- Because i have no idea about the complete address format. Is it normal to add
/jpg/image.jpg or may be jpeg/image.jpeg to address like i did in the above program
Engineer khalid
31-May-16 13:06pm
View
hi philo.o
i replced it but the result were worse... i got zero for all pixels
Engineer khalid
12-May-16 19:09pm
View
i guess the best thig i have got is to use
private void OnKeyPressed(object sender, KeyPressEventArgs e)
{
switch (e.KeyChar)
{
case 'q':
MessageBox.Show(e.KeyChar.ToString(), "Hellow");
break;
case 'w':
MessageBox.Show(e.KeyChar.ToString(), "Hellow");
break;
case 'e':
MessageBox.Show(e.KeyChar.ToString(), "Hellow");
break;
case 'r':
MessageBox.Show(e.KeyChar.ToString(), "Hellow");
break;
case 't':
MessageBox.Show(e.KeyChar.ToString(), "Hellow");
break;
case 'y':
MessageBox.Show(e.KeyChar.ToString(), "Hellow");
break;
case '^':
MessageBox.Show(e.KeyChar.ToString(), "Hellow");
break;
case '&':
MessageBox.Show(e.KeyChar.ToString(), "Hellow");
break;
;
}//switch
//if(e.KeyChar=='&' && e.KeyValue == 55) ;
}
Engineer khalid
12-May-16 17:38pm
View
To Karthik Bangalore
i am not looking for keycode for the shift key ,i am looking for crate ,excalamation ,ambersand...
To Sergey Alexandrovich
my program is a c sharp window form.. i will look at the msdn .my grade will take time
Engineer khalid
14-Mar-16 20:29pm
View
//program B
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.IO.Ports;
//https://msdn.microsoft.com/en-us/library/system.io.ports.serialport.readline(v=vs.110).aspx
namespace SerialConsol
{
class Program
{
static SerialPort _serialPort = new SerialPort();
//static StringComparer stringComparer = StringComparer.OrdinalIgnoreCase;
static bool _continue = true;
//static string name;
//static string message;
public static void Main(string[] args)
{
string name;
string message;
//bool _continue = true;
StringComparer stringComparer = StringComparer.OrdinalIgnoreCase;
Thread readThread = new Thread(Read);
// Create a new SerialPort object with default settings.
//SerialPort _serialPort = new SerialPort();
// Allow the user to set the appropriate properties.
_serialPort.PortName = "com1" ;//SetPortName(_serialPort.PortName);
_serialPort.BaudRate = 9600;//SetPortBaudRate(_serialPort.BaudRate);
_serialPort.Parity = Parity.None;//SetPortParity(_serialPort.Parity);
_serialPort.DataBits = 8;//SetPortDataBits(_serialPort.DataBits);
_serialPort.StopBits = StopBits.One;//SetPortStopBits(_serialPort.StopBits);
_serialPort.Handshake = Handshake.None;//SetPortHandshake(_serialPort.Handshake);
// Set the read/write timeouts
_serialPort.ReadTimeout = 500;
_serialPort.WriteTimeout = 500;
_serialPort.Open();
//_continue = true;
readThread.Start();
Console.Write("Name: ");
name = Console.ReadLine();
//Console.WriteLine("Type QUIT to exit");
/*while (_continue)
{
message = Console.ReadLine();
if (stringComparer.Equals("quit", message))
{
_continue = false;
}
else
{
_serialPort.WriteLine(
String.Format("<{0}>: {1}", name, message));
}
}//while
*/
Read();
readThread.Join();
_serialPort.Close();
}//Main
//----------------------------------------------------------
public static void Read()
{
//Console.WriteLine("hellow read");
string name = "MyName";
string message;
//bool _continue = true;
StringComparer stringComparer = StringComparer.OrdinalIgnoreCase;
//Console.Write("Name: ");
//name = Console.ReadLine();
while (_continue)
{
try
{
//string message = _serialPort.ReadLine();
message = _serialPort.ReadLine();
Console.WriteLine(String.Format("<{0}>: {1}", name, message));
if (stringComparer.Equals("quit", message))
{
_continue = false;
}
//else
//{
// _continue = true;
//}
}//try
catch (TimeoutException) { }
}//while
}//Read
}
}
Engineer khalid
14-Mar-16 13:42pm
View
now i used the cross serial cable which make the job done i could send a string and receive it from the other computer but
do not be surprise if i post another question regarding sending a byte or decimal
through the serial cable or trueley CROSS SERIAL CABLE
Engineer khalid
14-Mar-16 6:55am
View
after few hours i will buy a cross serial cable which might work but
do you see any error in my code ?
Engineer khalid
14-Mar-16 6:45am
View
sorry for reposting the quesion again but i was expecting to see an icon for updating the question. may be i did not see it
Engineer khalid
14-Mar-16 6:43am
View
i am using the old model serial cable not the cross serial cable
Engineer khalid
2-Mar-16 17:45pm
View
Hellow Garth.
my computer is set to Arabic calender not Gregorian, most likley this was the error
this is what i have got
Specified time is not supported in this calendar. It should be between 04/30/1900 00:00:00 (Gregorian date) and 05/13/2029 23:59:59 (Gregorian date), inclusive.
//
i will try in another computer , and your answer shall be accepted many thanks
Engineer khalid
7-Feb-16 0:13am
View
Hellow Kryukov
i could copy from the screen but to lock the bits (.LockBits) i must have a bitmap, and no Bitmap could be obtained from the richTextBox (as far as i know)
look at this code
Size s = this.Size;
s.Width=64; s.Height=64;
Bitmap memoryImage = new Bitmap(64,64,myGraphics);
Graphics memoryGraphics = Graphics.FromImage(memoryImage);
memoryGraphics.CopyFromScreen(1, 1, 1, 1, s);
///
if i could some how obtain the color( any color) from
memoryGraphics
this will be fine with me
otherwise i will print the letter
y (see my question above)
on form1 then use
Bitmap rtb = (Bitmap)form1.Clone();
//
if you have any comment about how to get any colour from
memoryGraphics
please do so , i will return to this site after couple of hours wether you commented or not with a grade of 5
thanks
Engineer khalid
6-Feb-16 4:06am
View
Hellow Kryukov
i have looked at your kind solution but now i am at work with more unexpected task. i will try your solution tomorrow and give you the grade of 5
Engineer khalid
16-Jan-15 15:59pm
View
To Mike Meinz
if i use
using Microsoft.Office.Interop;
instead of
using Word = Microsoft.Office.Interop.Word;
i loss the variable Word (see the above line)
from which i obtained the variable wrdApp
see also my the orignal question
namespace Wared
{
public partial class WordOrderForm : Form
{
Word.Application wrdApp;
Word._Document wrdDoc;
Engineer khalid
3-Jan-15 7:32am
View
it works
those are the changes
in FormLoad
SetDoubleBuffered(this);
in OnPaint
e.Graphics.DrawString("Happy new year", font1, brushWhite, xx, yy);
xx = xx + 5;
e.Graphics.DrawString("Happy new year", font1, brushRed, xx, yy);
if ((int)xx >= this.ClientSize.Width) xx = -this.ClientSize.Width;
in f1 i wrote
void f1(Object x,EventArgs e)
{
if(flage==1)Invalidate();//flage is global initially=0;
}
Engineer khalid
3-Jan-15 6:39am
View
1- i did the doubleBuffer
2- i wrote Invalidate(); in void f1(Object x,EventArgs e)//see my code above
3- i declare g2 globally
System.Drawing.Graphics g2;
in OnPaint i wrote
g2.DrawString("Jan-2-2015", font1, brushWhite, xx, yy);
xx = xx + 5;
g2.DrawString("Jan-2-2015", font1, brushRed, xx, yy);
if ((int)xx >= panel1.Width) xx = -panel1.Width;
the result is a red cross appeared on the Form
Engineer khalid
26-Dec-14 17:02pm
View
Dear Zoltan
i pressed on star 5 but it marks to star 3 ,beleive me may be something wrong with server
Engineer khalid
26-Dec-14 16:58pm
View
sorry i realized the answer from SendMessage thanks
Engineer khalid
26-Dec-14 16:54pm
View
Deleted
i promose you with 5 points untill now.
one more question if you can answer
if i call WindProc with its full parameters like this
LRESULT CALLBACK WindowProc(
_In_ HWND hwnd,
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam
);
which one of the parameters meet ( i mean equall to ) the
m.Msg ?
Engineer khalid
26-Dec-14 16:39pm
View
ok it works fine
i have 2 questions
how did you know that 0x0400+1 is for button1 ?
2nd question could i assume if i have 2 buttons and used the second button instead of the 1st should i write
private const int WM_BTNCLICKED = WM_USER + 2;
Engineer khalid
24-Dec-14 3:55am
View
Deleted
The following has solved the error
int NwavFilePlayed = 0;//declared globalley
private void Player_PlayStateChange(int NewState)
{
if ((WMPLib.WMPPlayState)NewState == WMPLib.WMPPlayState.wmppsStopped)
{
NwavFilePlayed++;
if (NwavFilePlayed < 5)
{
//MessageBox.Show("NwavFilePlayed=", NwavFilePlayed.ToString());
Pronounce("hellow");
}
//else MessageBox.Show("no more file to play", "NwavFilePlayed=" + NwavFilePlayed.ToString());
}
}//Player_PlayStateChange
private void Pronounce(string str)
{
string sound;
Player = new WMPLib.WindowsMediaPlayer();
Player.PlayStateChange +=
new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange);
Player.MediaError += new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Player_MediaError);
Player.settings.volume = 100;
//MessageBox.Show(str, "NwavFilePlayed=" + NwavFilePlayed.ToString());
sound = "x"+NwavFilePlayed.ToString()+".wav";
if (File.Exists(sound)) Player.URL = sound;
else Player.URL = "PalySilence4_OneSecond.wav";//
}
Engineer khalid
23-Dec-14 13:26pm
View
most likley my mistake is in method Player_PlayStateChange(int NewState)
Engineer khalid
23-Dec-14 13:13pm
View
look at this codes
x=10; Area=x*2; MessageBox.Show("Area="+Area.ToString());
x=100; Area=x*2; MessageBox.Show("Area="+Area.ToString());
so i am reusing same x vaiable ,so what is wrong with Player
do you mean i have to use player1 to play song1,then use palyer2 to play song2 ?
Engineer khalid
23-Dec-14 12:57pm
View
i want to play song one when song one finished and using the same player i want to play song two ,untill now things seems to me right please show me my error
Engineer khalid
26-Oct-14 4:39am
View
long time ago ,i was a c programmer it was illegal ,but if i am mistaken then this was illegal in fortran languge. thanks god ,i am still ridding a horse
Engineer khalid
25-Sep-14 4:29am
View
it works when i added this code to formload
Myline = new data_line[100];
for (i = 0; i < 100; i++)
Myline[i] = new data_line();
for (i = 0; i < 100; i++)
Myline[i].pnt = new point[100];
for (i = 0; i < 100; i++)
for (j = 0; j < 100; j++)
Myline[i].pnt[j] = new point();
Engineer khalid
25-Sep-14 4:08am
View
Object reference not set to an instance of an object.
use the new keyword to create an object instance
note the following line is heighlighted
Myline[0].pnt[0].X = 1;//located in FormLoad above
Engineer khalid
25-Sep-14 3:40am
View
i have changed the property of NPOINT still does not works,would u please write to me how to do that using List of points.
Engineer khalid
25-Sep-14 3:32am
View
the program compile with no error but at runtime the debugger wrote "use the new keyword to create an object instance"
i want to achieve storing data of those 2 lines using the 2 class,i fell this result is wrong because i feel i might need a property for an array of points in class data_line frankly i do not know how to do that
in general the program does not works even though it compile fine
Engineer khalid
21-Sep-14 4:36am
View
that is what i did... still error
Engineer khalid
6-Sep-14 14:59pm
View
i only changed this
//f2.ShowDialog(this);
f2.Show(this);
Engineer khalid
6-Sep-14 14:30pm
View
Excellent it works
Engineer khalid
6-Sep-14 13:53pm
View
Waitting
Engineer khalid
6-Sep-14 13:49pm
View
there is only one error,step 3 did not works it is this._form1.TurnOn_RestOfToolStripItems_22();//<-----
i will post the whole (similar small) program just follow me
namespace ShareDataBetweenForms
{
public partial class Form1 : Form
{
public Form2 f2; // holds reference to form 2
public Form1()
{
InitializeComponent();
}
// send button
private void button1_Click(object sender, EventArgs e)
{
if (f2 == null) // have we created it yet?
{
f2 = new Form2(this); // no, do so now
f2.Show(); // and display it to user
}
f2.textBox1.Text = textBox1.Text; // copy our text to child form
}
// close button
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (f2 != null) // form 2 active?
{
f2.Close(); // yes, close it
f2.Dispose(); // and dispose
}
}
public static void MyTry()
{
string x="hellow";
MessageBox.Show(x);
}
}
}
// now form2
namespace ShareDataBetweenForms
{
public partial class Form2 : Form
{
Form1 f1; // holds reference to parent form
public Form2()
{
InitializeComponent();
}
// constructor accepting form reference
public Form2(Form1 ff)
{
InitializeComponent();
f1 = ff; // save reference to parent form
}
private void Form2_Load(object sender, EventArgs e)
{ ;
}
// send button
private void button1_Click(object sender, EventArgs e)
{
f1.textBox2.Text = textBox2.Text;
this.f1.MyTry();//<----------------- Error
}
// close button
private void button2_Click(object sender, EventArgs e)
{
this.Close();
f1.f2.Dispose(); // dispose ourselves :)
f1.f2 = null; // remove reference from parent form
}
}
}
Engineer khalid
6-Sep-14 13:44pm
View
yes it does
Engineer khalid
6-Sep-14 8:56am
View
the 1st instruction has led me to find the solution
a breive solution is like this
in form1
public partial class Form1 : Form
{ public Form2 f2;
.
.
//in button click write
f2 = new Form2(this); // no, do so now
in form2
Form1 f1; // holds reference to parent form
public Form2()
{InitializeComponent();}
public Form2(Form1 ff)
{InitializeComponent();f1 = ff; // save reference to parent form}
private void button1_Click(object sender, EventArgs e)
{f1.textBox2.Text = textBox2.Text;}
To close f2 write
this.Close();
f1.f2.Dispose();
f1.f2 = null;
Engineer khalid
5-Sep-14 8:17am
View
Dear ravi. before i comment in your answer i created a textbox in the program not by toolBox and declared it as Public static,then in Form2 i could call it. i tried to do same thing for the menu but could not do that,i am a mechanical engineer, forgive me if i could not understand what u have wrote. How could i refrence Form2 to Form1 ? . i tried to declare the methode like this
Public instance void TurnOn_RestOfToolStripItems_22()
i wish if you give me full example
Engineer khalid
31-Aug-14 3:52am
View
Dear Kbrandwijk you moved me closer to the answer,this subject is quit very new to me ,as far as i understod, the server is the ip address which i can have from the remote computer,the name is any name i guess ! ,but the passward is still mestory to me
could it be any passward but it must be same at my computer and at the remot desktop ?
another thing is this code where should i write it ? may be in FormLoad or where
MSTSCLib.IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx();
secured.ClearTextPassword = txtPassword.Text;
please provide me with an example in detail many thanks
Engineer khalid
31-Aug-14 3:41am
View
To Mehdi Gholam i have read all the question or discusion at the end of that article,but could not find the answer that i and the members wants ,the article lead to several errors which i have solved and many member request explanation from the auther,but that is not all the auther post his article in another site which i think it belong to him and he seems he refused to reveal the answer
Engineer khalid
19-Aug-14 16:40pm
View
Hi Ravi Bhavani thank you very much
i assume you have solved the whole question you deserve the 5 points
Engineer khalid
19-Aug-14 16:31pm
View
my project as this ;
in Form1 i used a buttonClick by which i called another Form=>FormGoogle ,
by this code
FormGoogle frmGogle = new FormGoogle();
frmGogle.ShowDialog();
i reached the above Form1_Load,unfortunatlly the google window shows its self in a way that does not fit into my FormGoogle ,thats why i had to minimize it,then show it again in the above
InsertGoogleButton_Click(.....
Engineer khalid
19-Aug-14 16:18pm
View
in Google Class i added this code
[DllImport("user32", CharSet = CharSet.Auto)]
public extern static IntPtr ShowWindow(
IntPtr hWndG, int ShowHow);
//before Form1_Load i added
//private IntPtr Gwnd = (IntPtr)0;
//then in Form1_Load i added
Gwnd = (IntPtr)googleEarth.GetMainHwnd();//GetRenderHwnd();
ClassGoogle.ShowWindow(Gwnd, 6);//SW_MINIMUM);//SW_FORCEMINIMIZE
their is no error now every thing is fine but
how could i substude the number 6 with SW_MINIMIZE
it seems SW_MINIMIZE should be in google class
public static class ClassGoogle
{
[DllImport("user32", CharSet = CharSet.Auto)]
public extern static IntPtr GetParent(
IntPtr hWnd);
[DllImport("user32", CharSet = CharSet.Auto)]
public extern static bool MoveWindow(
IntPtr hWnd, int X, int Y,
int nWidth, int nHeight, bool bRepaint);
[DllImport("user32", CharSet = CharSet.Auto)]
public extern static IntPtr SetParent(
IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32", CharSet = CharSet.Auto)]
public extern static IntPtr ShowWindow(
IntPtr hWndG, int ShowHow);
}
// i am still need answer
Engineer khalid
23-Jul-14 12:01pm
View
hi bowlturner
i need soluton as this
when i write Globals. a listbox or menue should appear so i can choose one of them note there is a dot after Globals it is just like when u write MessageBox. u will see Show and showdialog
Engineer khalid
16-Jul-14 16:20pm
View
did not works i wrote this
Shape sh = oDataDoc.Shapes.AddTextBox(Microsotft.Office.Core.msoTextOrientationHorizontal, 1, 1, 200, 200, ref rng);
still with error,i added another refrence,it is Office .Net to my project but still
Microsotft.Office.Core.msoTextOrientationHorizontal is unknown to the visual studio
Engineer khalid
14-Jul-14 5:56am
View
does the back ground be attach to the form.cs Designer like the way we do as Load,click,KeyDown,KeyPress,FormClosed,FormClosing,Enter in the property menue or is it just a method like
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
// This method runs on the main thread.
Words.CurrentState state =
(Words.CurrentState)e.UserState;
this.LinesCounted.Text = state.LinesCounted.ToString();
this.WordsCounted.Text = state.WordsMatched.ToString();
}
?
Engineer khalid
14-Jul-14 5:40am
View
i have never don some thing in the back groud but i shall read in the msdn,i appreciate if you refer me to an example for the backgroud, the reason i am in short time
Engineer khalid
11-Jul-14 9:05am
View
your answer is correct you deserve the 5 points but i could not find any button to send this 5 points
Engineer khalid
11-Jul-14 9:05am
View
Deleted
your answer is correct you deserve the 5 points but i could not find any button to send this 5 points
Engineer khalid
11-Jul-14 8:53am
View
few minutes ago i realize the above program works fine but acually my program looks like this
protected override void OnClosing(CancelEventArgs e)
{
DialogResult result;
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
result = MessageBox.Show(this, "Are You Sure Want to exit", " Answer Yes or No",
buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.RightAlign);
if (result == DialogResult.Yes)
{
//base.Close();
this.Close();
}//Yes
else e.Cancel = true;
}
//------------------
private void ExitFromFormA_ButonClick(object sender, EventArgs e)
{
DialogResult result;
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
result = MessageBox.Show(this, "Are You Sure Want to exit", " Answer Yes or No",
buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.RightAlign);
if (result == DialogResult.Yes)
{
//base.Close();
this.Close();
//Application.Exit();
}//Yes
;
}
protected override void OnClosing(CancelEventArgs e)
{
DialogResult result;
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
result = MessageBox.Show(this, "Are You Sure Want to exit", " Answer Yes or No",
buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.RightAlign);
if (result == DialogResult.Yes)
{
//base.Close();
this.Close();
}//Yes
else e.Cancel = true;
}
private void ExitFromFormB_ButonClick(object sender, EventArgs e)
{
DialogResult result;
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
result = MessageBox.Show(this, "Are You Sure Want to exit", " Answer Yes or No",
buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.RightAlign);
if (result == DialogResult.Yes)
{
//base.Close();
this.Close();
//Application.Exit();
}//Yes
;
}
Show More