|
Hy
I have a RichTextBox and I typing words separated with SPACE. I want to set different color for each word typed. Can anybody tell me how can I do that or give me an short example.
Thanks
|
|
|
|
|
Hai mihk, I'm working on similar application also.
In my opinion, you can do that on 2 ways.
1. scan through the first char loop until end, when you find "SPACE" / "32" in ASCII, you just put a little code of RTF Formatting. well, let's just say like this.
<br />
StringResult = "";<br />
StringResult = {\rtf\ansi {\colortbl; \red0\green0\blue255;\red255\green0\blue0;}; <br />
bool toggle = false;<br />
for(int i=0; i < YourString.GetLength(0); i++)<br />
{<br />
if(toggle)<br />
{<br />
StringResult = StringResult + @"\cf1";<br />
}<br />
else<br />
StringResult = StringResult + @"\cf2";<br />
<br />
StringResult = StringResult + YourString[i];<br />
<br />
if(YourString[i] == (char)32)<br />
{<br />
if(toggle) toggle = false;<br />
else toggle = true;<br />
}<br />
}<br />
you may search more about RTF formatting on microsoft web site.
2. you can just use the method RTB.Selection to change the font, forecolor, backcolor, etc. find more info about this on MSDN help.
CMIIW
|
|
|
|
|
I want to know how Yahoo messenger photo sharing works. Is it using byte streaming by using a web service? I want to develop that kind of application using C# or C++. So please help me to find some articles or sample source codes.
Regards,
Lilupa Karunarathne.
|
|
|
|
|
Hi All,
I have a MFC ActiveX control which has a method which returns a variant which
contains a safe array of double values .
void Calculate(double value,VARIANT *Result);
"Result" variable is of "Out" type.
When i'm trying to access this function from C# i'm by passing variable of type "Object" i'm getting RunTime Exception as follows
"An unhandled exception of ype 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
Additional information: Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))"
Please Anyone help me to solve this problem
I can access this from VB 6 without any issues.
Thanks in Advance
|
|
|
|
|
Hi
Can you supply the IDL of the Interface that contain the method you are trying to invoke ???
|
|
|
|
|
Hi nissims
Thanks for your reply,
Below is the IDL for my MFC ActiveX Control
library MyActiveXLib
{
importlib(STDOLE_TLB);
// Primary dispatch interface for CMyActiveXCtrl
[ uuid(9117C567-1EAD-48B3-BA9E-C4D44852D181),
helpstring("Dispatch interface for MyActiveX Control")]
dispinterface _DMyActiveX
{
properties:
methods:
[id(1), helpstring("method AddDataPoint")] void AddDataPoint(LONG lngIdx, DOUBLE dblXVal, DOUBLE dblYVal);
[id(2), helpstring("method AddDataPoints")] void AddDataPoints( LONG lngNoOfPoints, VARIANT varXVals, VARIANT varYVals);
[id(3), helpstring("method GetData")] LONG Calculate( DOUBLE dblXVal, VARIANT* varResult);
};
// Event dispatch interface for CMyActiveXCtrl
[ uuid(07A82910-34BC-43C2-ADAE-A462286D4E10),
helpstring("Event interface for MyActiveX Control") ]
dispinterface _DMyActiveXEvents
{
properties:
// Event interface has no properties
methods:
};
// Class information for CMyActiveXCtrl
[ uuid(E98E4ED3-C038-4705-8EAB-43AD8A1B75AB),
helpstring("MyActiveX Control"), control ]
coclass MyActiveX
{
[default] dispinterface _DMyActiveX;
[default, source] dispinterface _DMyActiveXEvents;
};
};
"varResult" variable of "Calculate" method will return the SafeArray of Double values.
Please suggest me the solution to solve this problem
Thanks again
|
|
|
|
|
Hi
Sorry about the delay, i just saw your answer now.
Are you passing an object argument that encapsulate a double array ???
For example:
object result = new double[10];
|
|
|
|
|
|
i want add reports to my project, my project contain 3 layers (1- presentation layer 2-Business Logic layer 3-Data Access layer )
|
|
|
|
|
Hi to all,
I want to check the specified file exist in the specified directory or not....
how can i do this?
Pravin
|
|
|
|
|
create the instance of FileInfo class
//FileInfo f;
initialze that in the following manner
//f = new FileInfo("something.txt");///mention the complete path
and then use this property to know whether this file exists or not
///if(f.Exists == false) /// means the file doesn't exist
ok
|
|
|
|
|
|
Hi
In order to check if a specific file exists
You can use the File.Exists static method , you can also use the
FileInfo.Exists property but for that you need to construct a FileInfo Object
|
|
|
|
|
Thanks Nissims,
i have used here object.FileExists(filespec) method.
Pravin
|
|
|
|
|
You can directly check the path using
if(System.IO.File.Exists(Path))
Regards
DilipRam
|
|
|
|
|
Hi Everybody,
We have a problem in displaying the data combining two tables....
we have table1 where a primary key is set to field1 and another table table2 where a foreign key is set to field1 with the same name as it is in the table1.
we gave the query to the data adapter as
" SELECT field1,field2,field3 FROM table2,table1 WHERE table1.field1=table2.field1";
But all the table2 rows are displayed without satisfying the condition we gave in the sql query.
Please help us at the earliest.
Thanks and Regards,
Priya
|
|
|
|
|
SELECT table1.field1,table1.field2,table1.field3
FROM table1 inner join table2 on table1.field1=table2.field1
Rami Abdalhalim
|
|
|
|
|
Thanks ..... It Worked....
But the filtered row is repeatedly getting displayed in the output table.....
We want the row to be displayed only once....
Please suggest..
Priya
|
|
|
|
|
Hello Everyone,
Can anybody let me know "Wht's the benefits of the Virutal function in C#"
|
|
|
|
|
To get polymorphic behavior.
|
|
|
|
|
Can u explain it further.....................
|
|
|
|
|
Given your question I suspect object oriented programming is new to you. A forum really isn't ideal for learning a topic as large as OO from scratch. I recommend getting a book or spend a lot of time researching on the internet (google is your friend). You can for example read wikipedia for a VERY broad overview:
Object Oriented programming on Wikipedia[^]
If you have specific questions not easily answered by googling, then it is time to ask in the forum.
|
|
|
|
|
By marking the function as virtual you are indicating that it is legal for a derived class to "overload" that function and change the behavior, either completely or partially.
This concept is generally called polymorphism and is one of the central concepts in object oriented programming. There are several good websites and reference books that explain OO programming theory, so you might want to check those out and get in order to get a better understanding.
|
|
|
|
|
Hai Everbody,
Warm Greetings!
Can any one suggest me the techniques and methods for license key generation.
Also how can i identify a system uniquely using the hardware information such as Processor ID and MAC Address.
And how can I get the Processor ID.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Well following are the licensing schemes:
- Per Processor licensing
- Per User licensing
- Per Machine licensing (unlimited per machine)
- One time license(for installations etc)
You can ger Processor ID from Win32_Processor and MAC from Win32_NetworkAdapterConfiguration.
A better approach would be to use Win32_ComputerSystemProduct.UUID for uniquely identifying a system and then enforce various licensing schemes
before c# there was darkness
|
|
|
|