|
Hi Sid!
There's no way to decide whether an assembly contains a type that implements your interface without loading the assembly.
You have to load the assembly to get access to the types defined in the assembly and when none of the types implements your interface then you have found out that this dll isn't a valid plugin.
In order to be able to unload the assembly you must load your assemblies into a separate AppDomain , but that's shown in the existing articles I guess...
Regards,
mav
|
|
|
|
|
Hey!
If i Create a MemoryStrem, and write data to this stream at the folowing way
<br />
StreamWriter sw = new StreamWriter(StrmStore.getUnitStream);
sw.Write(data);
And then i want to read the data in the stream from another part of the program that have access to this MemoryStream
<br />
char[] buffer = new char[memoryStream.Length];<br />
sr.Read(buffer, 0, (int)memoryStream.Length);<br />
<br />
string test = new string(buffer);<br />
The problem is that the position where the streamreader will read is set to the last element in the stream(probly by the stream writer that writed the data), and when the stream reader is reading it is not removing the readed elements?
What am i doing wrong? Maby i shold solve this problem another way?
BestRegards
Jimmy
|
|
|
|
|
A MemoryStream is basically an array of bytes that's growing dynamically when data is written into the MemoryStream.
Like every Stream , MemoryStream also has a Position property that is marking the position where the next read or write will occur.
So if you want to read from the beginning, you'll have to set memoryStream.Position to 0.
Just reading from the MemoryStream doesn't remove the bytes read, so if you want this behaviour you should look for a FIFO stream implementation.
I think Ianier Munoz has such a class in his
A low-level audio player in C#[^].
Regards,
mav
|
|
|
|
|
Thanks!
Say that im about to read the stream, and i sets the position to 0. Then my writer whant to write to the stream in anohter part of the program, then it will write the new data on position 0, this would make alot of problem i think?
The ultimate solution would be a stream where i write data last in the array, and when reading i read from the beginning, and every readed byte will be removed from the array.
Is a stream like this cald a FIFO stream?
BestRegards
Jimmy
|
|
|
|
|
FIFO first in first out
(http://www.codeproject.com/cs/media/cswavrec.asp)
|
|
|
|
|
Hi
i needed to import a picture in a word document
problem is not to import the picture but get the picture at the end of
the document
Can someone help me please
thanks
|
|
|
|
|
hi all
i am having a problem. I have a tree view having some nodes. the same nodes are also present in the rtb(rich text box). what i want to do is that when i click on a perticular node, that node in the rtb should be highlighted. also reverse.
can anyone help me in this regards?
|
|
|
|
|
Nodes are present in the Richtextbox? What does that mean? Do you have the text of all the nodes in the textbox? If so, you can just subscribe to the Clicked event on the Tree, get the selected node and find the text of the node in the textbox..
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
hi.
yes the text of the node is in the rtb.
but how can i get a perticular text from a rich text box?
thanks for replying
|
|
|
|
|
You could subscribe to the SelectionChanged event.
Then, using the SelectionStart property, you can find out where the new selection is and extract the word from there.
Regards,
mav
|
|
|
|
|
when i click on the rich text box, how can i get the character number?
like 7th character from the start?
|
|
|
|
|
The SelectionStart property gives you that. SelectionLength gives the number of characters selected from SelectionStart .
For the reverse, ie. selecting text when a node is clicked, that's easy, you can just call the Find method on the text box and select it.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
thanks for the help.
it works now
|
|
|
|
|
Hello everyone!
I'm designing datetime textbox by C# & ASP.NET, I want data type is datetime but users access in my website enter datetime such as mm/yyyy.
How can I do?
Please tell me!
Thank you!
|
|
|
|
|
You can simply parse the TextBox into a DateTime. If the entered Date is of a recognized format, this will automatically convert the string into a DateTime.
e.g.:
DateTime myDate = DateTime.Parse(textBox1.Text);
If you want to force the users to use a certain format, check the textbox for the compliance before you parse it. Show some error-message if it does not.
Cheers
Sid
|
|
|
|
|
how to use char** from C library to C# using invoke.
[C]
int TestFn( char** UserBuffer);
[C#]
[DllImport[("My_C_DLL")]
public static extern int TestFn( ref IntPtr UserBuffer);
[USE in C# CODE]
IntPtr pBuffer = new IntPtr();
TestFn(ref pBuffer);
When I used it like that, I did get NULL values. What are we doing wrong here?
Shail Srivastav
shailsrivastav@hotmail.com
blog
|
|
|
|
|
try this
[DllImport[("My_C_DLL")]
public static extern int TestFn([In, Out] string[] UserBuffer)
it's in MSDN at ms-help://MS.MSDNQTR.2005APR.1033/cpguide/html/cpconarrayssample.htm
|
|
|
|
|
Thank a lot, It works great . Can you please send me the MSDN help link again, I am not able to open the link.
Thanks
Shail
Shail Srivastav
shailsrivastav@hotmail.com
blog
|
|
|
|
|
|
Hi,
I'm using RichTextBox control. My require is to shieding the "select " Function, i.e. preventing from the Function that when I hold the mouse down and move, the segment of the text will be selected.
How to realize this ?
Please help me !
welspring
hope for help
|
|
|
|
|
Hi!
A RichTextBox where you can't select the text (basically a label with formatting) is a by-product of my article here[^]
I guess that's exactly what you want.
Regards,
mav
|
|
|
|
|
HI,
I have seen your implementation of not seleting in RichTextBox. But sorry, I want the richtextbox can get focus yet not selecting. How to do?
welspring
hope for help
|
|
|
|
|
Hi!
What's the point in allowing the RTB to receive focus when the user can't do anything in it?
A label can't receive focus either, so why should a label with formatted text?
mav
|
|
|
|
|
Hi everybody!
I selected from calender, enter textbox after that I want insert SQL Server 2000.
How can I do it?
Please, help me!
Thank you!
study, study and studymor
|
|
|
|
|
insert into table(date) values(dateTimePicker1.value)
try this query in the sqlCommand object.
regards
Rizwan
|
|
|
|