|
Have a look at the System.IO classes for StreamReader, StreamWriter, etc...
MSDN Link[^]
|
|
|
|
|
Hi,
It was missing the allow drop property set to true in the target control.
Thx,
Nuno
|
|
|
|
|
Post in wrong thread!
Sorry
Nuno
|
|
|
|
|
Hi,
I'm trying to implemenent some drag and drop functionality.
Basicly i have two controls:
- A listbox, the source of drag
- A tabcontrol, the destiny of drag
Well, i have wrote the following events:
<br />
void layoutPanelOnMouseDown(object sender, MouseEventArgs me)<br />
{<br />
Layout temp = null;<br />
ListBox lb = (ListBox)sender;<br />
int index = lb.IndexFromPoint(me.X, me.Y);<br />
if (index >= 0)<br />
{<br />
lb.DoDragDrop((string) lb.Items[index], DragDropEffects.Copy);<br />
}<br />
}<br />
<br />
void displayEditorOnDragEnter(object sender, DragEventArgs de)<br />
{<br />
if (de.Data.GetDataPresent(DataFormats.Text))<br />
{<br />
de.Effect = DragDropEffects.Copy;<br />
}<br />
else<br />
{<br />
de.Effect = DragDropEffects.None;<br />
}<br />
<br />
}<br />
<br />
void displayEditorOnDragDrop(object sender, DragEventArgs de)<br />
{<br />
string layoutName = (string)de.Data.GetData(DataFormats.Text);<br />
}<br />
I have 3 tabs in the tabcontrol and i want to apply this to the first tab.
When i try to do something with this, i can drag, but i cant drop.
This is in a MDI application where the listbox is in the main form and the tabcontrol is in the child form.
Any tips?
Thx,
Nuno
|
|
|
|
|
|
Hi,
It was missing the allow drop property set to true in the target control.
But now i have another problem:
I want to pass thru the drag and drop a class made by me.
As i can see the allowed formats for drag and drop have a specific set of types.
What type should i use to pass a custom class?
My other option is pass text and then get it based on the text, but using that form i then need to access the MDI parent to have access to the structure that holds the item i need.
Any tips?
Thx,
Nuno
|
|
|
|
|
Hi,
i have a unicode string in arabic language. i want to convert it to its integer value. but when i use Convert.Int32(unicodestring). it raises exception that the input is in invalid format. please guide me how to convert unicode string to int.
Regards,
Omar Lodhi
|
|
|
|
|
Posting the relevant code sample would be helpful. Also, you can try Int32.Parse().
Cheers,
Vikram.
The cold will freeze our stares
We won't care...
|
|
|
|
|
How many characters in the string? Maybe thats the problem?
Perhaps you need to ittereate through each character of the string in turn, something like:
foreach( char character in unicodeString )
{
int charValue = Convert.ToInt32( character );
}
Just an idea.
If your still stuck, you should post some of your code.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
Hi,
i have to convert a unicode string to its hex equilent. i have converted this from a VB6 code that uses AscW() method to convert unicode to a integer value and then to Hex value.
Here is code
String strSrc="جمل هندسة في الدنيا أن تبني جسرا من الأمل على بحر من اليأس..";
strResult = "";
for (int i = 0; i < strSrc.Length; i++)
{
try
{
//tried this one get exception
//nVal = Int32.Parse(strSrc.Substring(i, 4));
//tried also statement below also get exception
nVal = Convert.ToInt32(strSrc.Substring(i, 4));
strHex = Convert.ToString(nVal, 16);
strResult += strHex;
}
catch (FormatException e)
{
;
}
}
Exceptoin error string is "Input was not in correct format"
Thanks and Regards,
Omar
|
|
|
|
|
Sorry, mate; I don't know any Arabic, so I have no idea if the string you have is a valid numeric string. If what you have is indeed a VALID numeric string in Arabic, perhaps the problem is the locale/culture settings.
Int32.Parse() and Convert.ToInt32() both have various overloads - why don't you check them out? Pay special attention to the ones that take a CultureInfo parameter. Also, given Arabic is an RTL language, are you sure Substring() is returning the correct substring?
Cheers,
Vikram.
The cold will freeze our stares
We won't care...
|
|
|
|
|
Hi,
i think RTL is only for displaying data. in case of string storage it is stored just same as normal string. this code is working in VBA that reads unicode converts unicode string to hex format. do you know any method equivalent to VB method AscW for getting code of any unicode character.
Thanks,
Omar
|
|
|
|
|
hi all,
i've developed a small software [windows application]and i wanna make a privilage/provision that,
user will have a button[update] in my appliation where in which i will provide current version
whenevr user click on update buttton,
i need to compare that current version with the version that is available on my website.
PLEASE HELP ME HOW TO DO THIS,
thnx in advance,
i am using C#.Net and VS2005
prashanth
|
|
|
|
|
|
I can't get regasm.exe to load my .dll it says it is not a valid .NET assembly. Why not in built just fine.
I can't figure out which way to go. The .dll is for extending the ESRI engine.
God Bless,
Jason
Programmer: A biological machine designed to convert caffeine into code. Developer: A person who develops working systems by writing and using software.
[ ^]
|
|
|
|
|
Which version of .NET are you using? .NET 1.x tools cannot use .NET 2.0 assemblies.
I knew that, but wasted 10 minutes of my life because the PATH settings were not correct.
Cheers,
Vikram.
The cold will freeze our stares
We won't care...
|
|
|
|
|
Its building and reg-ing correctly now. But now my classes wont show up in Arc.
I will get it sooner or later.
thanks
God Bless,
Jason
Programmer: A biological machine designed to convert caffeine into code. Developer: A person who develops working systems by writing and using software.
[ ^]
|
|
|
|
|
I exported an Access 2003 database into an XML file which is in the following format (where DataTable is a single mdb table):
<Data>
<DataTable>
<Index>1</Index>
<Type>Event<Type>
<Name>Some name</Name>
<Desc>A simple description</Desc>
<Details>This is a brief detail for this item.</Details>
</DataTable>
<DataTable>
<Index>2</Index>
<Type>Event<Type>
<Name>Another name</Name>
<Desc>Another simple description</Desc>
<Details>Another brief detail.</Details>
</DataTable>
...
</Data>
I am trying to understand the different methods of reading this data into a grouped listview control. The groups are based on the value of the "type" element. I don't know if I should use XmlDocument, XmlReader, or XmlTextReader. Once I get the type then I need to add the name, desc, and details in subitems. The help files don't seem to help clear it up.
Mark
|
|
|
|
|
That format looks like a DataSet format. I would load it into a dataset. Then you can use the dataset to do what you need. You can get the DataView off of the dataTable and use the Rowfilter property to show only certain types if you need to do that.
Hope that helps.
Ben
|
|
|
|
|
First off, I am a Windows network technician with some coding back ground, mostly in C++ and VB, new to C#, so please bear with me.
I am trying to modify the following project by Douglas M. Weems (thanks a bunch Douglas for the code, it's been a GREAT help):
http://www.codeproject.com/cs/media/IECapture.asp[^]
We have a need to automate the process of capturing web sites of our clients as images. To do this I am modifying Douglas' project to do so. I have made most of the changes we require, but am stuck on one, hopefully last, issue.
I added a WebBrowser control, and modified the code to read the site loaded in it rather then from the first available web browser window open.
My problem is that when I automatically run the the button_click event which has the image capture code, the WebBrowser control does not load quickly enough, and the code calls properties of this control that are set to "null".
If I launch the app, and manually click the button which runs the capture code, it works without an issue, the image captures.
This is how I setup the automated process. On the Form Load event I read in a text file with the URL, and the WebBrowser control called axWebCap browses to this site. I then run the capture code in the Form Activated event.
I discovered that if I do this, that axWebCap.ReadyState = READYSTATE_LOADING. Now if I run this manually by running the ap and click the capture button the axWebCap.ReadyState = READYSTATE_COMPLETE.
I guess my question is, how can I run this code in a function after the Form has completely loaded, and therefore the axWebCap WebBrowser control has completely loaded as well, and it's properties are no longer set to null?
BTW, I am using Visual C# 2005 EE, and I would be more then happy to clarify anything I just posted.
Any help would be greatly appreciated!
Thanks,
Justin
|
|
|
|
|
Justin,
After you've assigned the URL to navigate to, you need to loop until the ReadyState is READYSTATE_COMPLETE; not actually assign it values.
Something like:
while (axWebCap.ReadyState != READYSTATE_COMPLETE)
{
// tells application to process messages ...
Application.DoEvents();
}
// when you come out of this loop, your page is now loaded and
// all the objects (DOM) etc... should exist
Hope that helps.
|
|
|
|
|
Thanks Douglas for your responce!
I actually have tried creating a while loop like this. I just can't figure out what to put for the "Application.DoEvents()" that will cause the WebBrowser control to fully load, or wait for it to fully load.
I tried the following:
string WebReady = axWebCap.ReadyState.ToString();<br />
<br />
while (WebReady != "READYSTATE_COMPLETE")<br />
{<br />
WebReady = axWebCap.ReadyState.ToString();<br />
}<br />
But that just causes an infinite loop. I am thinking that is because it is not refreshing the Ready Status. Do I need to refresh the form or something?
I thought about putting a timer in, but thought that could cause issues in the future if the page load fell outside the time limit.
Thanks again,
Justin
|
|
|
|
|
here's an example I just slapped together for testing ... grant it, my object names differ, but you'll get the idea ...
<br />
private void OnFormLoad(object sender, EventArgs e)<br />
{<br />
this.webBrowser1.Navigate(@"http://www.cnn.com");<br />
while (this.webBrowser1.ReadyState != WebBrowserReadyState.Complete)<br />
{<br />
Application.DoEvents();<br />
}<br />
MessageBox.Show("DONE loading!");<br />
<br />
}<br />
|
|
|
|
|
Thanks again Douglas!
I hear what you are saying, I just don't know what process to run that will refresh the WebBroswer.ReadyState until it is completed. What event or process can I keep running that will get me to WebBrowserReadyState.Complete before I run the capture code.
Here is some of the code:
private void frmMain_Load(object sender, EventArgs e)<br />
{<br />
Initialize_Site(null, null);<br />
<br />
string WebReady = axWebCap.ReadyState.ToString();<br />
<br />
while (WebReady != "READYSTATE_COMPLETE")<br />
{<br />
WebReady = axWebCap.ReadyState.ToString();<br />
}<br />
<br />
}<br />
<br />
private void frmMain_Activated(object sender, System.EventArgs e)<br />
{<br />
button1_Click(null, null);
}<br />
<br />
private void Initialize_Site(object sender, EventArgs e)<br />
{<br />
TextReader WebConfig = new StreamReader(@"c:\\IECapture\config.txt");<br />
<br />
int LineCount = 4;<br />
string[] ConfigLines = new string[LineCount];<br />
<br />
for (int i = 1; i < LineCount; i++)<br />
{<br />
ConfigLines[i] = WebConfig.ReadLine();<br />
}<br />
<br />
string Address = ConfigLines[1];<br />
axWebCap.Navigate(Address);<br />
<br />
}
Thanks,
Justin
|
|
|
|
|
You need only add a call to Application.DoEvents(); That will tell your application to pump messages and whatnot while you wait for the ReadyState to change ... so in your code, you would
private void frmMain_Load(object sender, EventArgs e)
{
Initialize_Site(null, null);
string WebReady = axWebCap.ReadyState.ToString();
while (WebReady != "READYSTATE_COMPLETE")
{
// tell application to process pending events
Application.DoEvents();
// get the readystate
WebReady = axWebCap.ReadyState.ToString();
}
//add your capture code here ...
}
-- modified at 16:19 Tuesday 3rd April, 2007
|
|
|
|