|
Try the following..
<PRE>
rootInterface IRootInterface = new rootInterface();
IRootInterface.MdiParent = this;
IRootInterface.Show();
</PRE>
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Hi,
I am having a situation ,i've to display more than 10 fields from database to the crystal report
But since i had to display it horizontally in the report ; But it's size seems to be fixed .but vertically it can be done .
Plz help.
|
|
|
|
|
hi! im having problems with a code im working on a Windows Form Application
I will post the code I have so far:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Trabajo_de_Programacion1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string nombre;
int intentos;
intentos = 0;
nombre = textBox1.Text;
label8.Text = "Hola," + nombre + " !";
switch (comboBox1.SelectedIndex)
{
case 0:
{ intentos = 10; }
break;
case 1:
{ intentos = 8; }
break;
case 2:
{ intentos = 5; }
break;
case 3:
{ intentos = 3; }
break;
}
label9.Text = "Numero de intentos restantes: " + intentos;
Random randNum1 = new Random();
randNum1.Next();
label10.Text = "" + (randNum1.Next(4));
randNum1.Next();
label11.Text = "" + (randNum1.Next(4));
randNum1.Next();
label12.Text = "" + (randNum1.Next(4));
randNum1.Next();
label13.Text = "" + (randNum1.Next(4));
}
private void button2_Click(object sender, EventArgs e)
{
int intentosrestantes, intentos, ;
intentos = label9.Text; intentosrestantes = (intentos - 1);
label9.Text = "" + intentosrestantes;
}
}
}
The error I get is on the label9.Text and it says :Cannot implicitly convert type "string" to "int"
Thanks for the help!
|
|
|
|
|
As errors says implicit conversions are not possible. You need to cast it. Take a look at int.TryParse()
Best wishes,
Navaneeth
|
|
|
|
|
How do I cast it? where do I add the int.TryParse()?? I have been using C# for a little while and still dont know how to use it very well :S
Thanks! ^^
|
|
|
|
|
int intentos;
if(int.TryParse(label9.Text, out intentos))
{
} These are basic things and you should really get a book to learn all these rather than from an online forum.
Best wishes,
Navaneeth
|
|
|
|
|
|
I wouldn't call that casting; interpreting a string to get a value (integer, real, date, ...) is called parsing.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
If it is parsing, then for a string like "string123", it should return 123 right?. But int.TryParse() will not do it. So more clear description would be what MSDN says.
Converts the string representation of a number to its 32-bit signed integer equivalent. A return value indicates whether the conversion succeeded.
Best wishes,
Navaneeth
|
|
|
|
|
You can use
<br />
Convert.ToInt32( label9.Text)<br />
|
|
|
|
|
Hello everybody!
I'm thinking of developing a web site ripper (copier) application in C# on Windows. As I see it, it is not a very complicated task in terms of the overall picture. However, challenges may arise when developing particular features, at a finer level of granularity.
So, in large, I think I need to:
- get the required html document
- construct a document links tree
- recursively parse the initial document to find links to other documents and add them to the document tree
- once the tree is constructed, recursively get the desired resources (say, all the documents or just the images) and store them on disc
- modify the links in the locally stored html documents to point to the local disc structure
Is there anything specific that I should be careful with? What challenges may arise? Have I missed something important? I would welcome your feedback.
Best regards!
|
|
|
|
|
fireblade80 wrote: Is there anything specific that I should be careful with? What challenges may arise? Have I missed something important? I would welcome your feedback.
I would imagine your big challenge is making sure you keep track of links so you don't recursively load the same site over and over. And that you don't jump out and end up loading all all of the web.
That and the fact that most big websites ( such as CP ) have things in place to stop you, because of the cost of such action in terms of server load.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
As CG said keeping track of the links already visited and avoid duplicate requests would be challenging as links can appear in different forms like http://somewebsite.com or http://www.somewebsite.com. Other area where you will have problems will be to handle links that uses JS. It won't be simple hyperlinks but calls a JS function and redirects to a page.
fireblade80 wrote: Is there anything specific that I should be careful with?
There are few general things to consider.
- Use a data structure that offers fast lookups for keeping the visited URLs. Using sequential data structures like
List(T) will be a poor choice. Try with HashSet(T) which uses hash tables internally and gives you lookups in constant time. - You don't really need to construct the link tree. A better approach would be to parse the links immediately after finding. I mean a producer/consumer queue would be good. A producer thread finds all the links and put it to a queue. Several consumer threads will be listening to the queue and processing each links. This way you can save the time you use for constructing link tree
- Some pages will return a HTTP status code 301 or 302 which means Moved Permanently and 302 Found. Your code should be able to handle this and request again to the changed URL.
- Define a depth level so that your application will not go into too depth when grabing URLs
Best wishes,
Navaneeth
|
|
|
|
|
Great advice. I should use HashSet<T> more often...
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Thanks
HashSet is great when you don't care about the order of elements it stores.
Best wishes,
Navaneeth
|
|
|
|
|
-Please keep in mind I am still a beginner programmer when adding replies. I need stuff explained in simple terms with some comments so I can understand it better. Thanks.-
For some reason I cannot seem to add items to various colums in my listview. I set all three columns up in the designer as well as the listview.
A little more info on what I am trying to achieve. I have this XML file:
<?xml version="1.0" encoding="utf-8">;
<List>;
<tem Name="One" Version="1.0" Filename="file.exe" />;
<Item Name="Two" Version="2.0" Filename="file2.exe" />;
</List>;
I have two queries as such:
var query_name = from n in ModListUser.Root.Descendants("Mod")
select n.Attribute("Name").Value;
var query_ver = from v in ModListUser.Root.Descendants("Mod")
select v.Attribute("Version").Value;
I need to line up the name and Version attributes into two different colums, but yet keep them lined up. So it would need to be like this:
Column1 | Column2 | Column3
One | 1.0 | file.exe
Two | 2.0 | file2.exe
For every item in the list which I don't know how many but eventually I am going to compare only selected values.
I realize I need a new Attribute for the file names that way I can match a directory and get only the needed items. Is there a way I can combine my query to get all the attributes for item with a specific name. Like being able to get 1.0 from One and so on?
So say if user only has Two but not One I would want to only display Two.
|
|
|
|
|
Here is adding the Item nodes into list view. You don't have to use LINQ. A simple XPath query should be enough.
XmlNodeList itemNodes = document.SelectNodes("/List/Item");
foreach (XmlNode node in itemNodes)
{
XmlAttribute nameAttribute = node.Attributes["Name"];
XmlAttribute versionAttribute = node.Attributes["Version"];
XmlAttribute filenameAttribute = node.Attributes["Filename"];
ListViewItem root = listViewObject.Items.Add(nameAttribute.Value);
root.SubItems.Add(versionAttribute.Value);
root.SubItems.Add(filenameAttribute.Value);
} You need to set the View property of listview to Details .
c#coder2009 wrote: Is there a way I can combine my query to get all the attributes for item with a specific name. Like being able to get 1.0 from One
Again a simple XPath query should do it.
XmlNode itemNode = document.SelectSingleNode("/List/Item[@Name='One']"); Look into the itemNode.Attributes collection.
Best wishes,
Navaneeth
|
|
|
|
|
XmlNodeList itemNodes = document.SelectNodes("/List/Item"); // assuming document is a XmlDocument instance.
Doesn't work. I get an error under document. I use XDocument not XmlDocument, should it be the same? Document should be the name of the XML object I load correct?
|
|
|
|
|
XDocument is for LINQ. I have used XmlDocument .
Best wishes,
Navaneeth
|
|
|
|
|
Thanks man, works great. Been waiting all day for a reply. Is there a way to check a directory for the file name and only display those that exist? Or do I need to display them all all the time? I knwo I am way overcomplicating this but once I figure this out I should be ok for the rest of my application. I think. Would you be able to put detailed comments in your code for me to understand better please?
I tried to add
if (File.Exists(PathVariable + Filename))
before the output but as soon as I do I get no output at all.
modified on Monday, October 19, 2009 1:31 AM
|
|
|
|
|
Yes. File.Exist() is the way to check the file existence. But I don't understand what issue you are facing here.
Best wishes,
Navaneeth
|
|
|
|
|
hi,
i am trying to use the borzoi 1.02 with Visual studio 2008 C# .NET,
i am trying to use the ECC implementation in this library,
so how can i integrate this library and use its functions from within VS 2008 C#.
thanks alot
|
|
|
|
|
What on earth are you talking about ? What makes you think we would know ? What is the library written in ? If it's not .NET, if it's a dll, you can use pinvoke to write a wrapper.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
If two client calls the same method, second client is waiting for the first client finished on WCF.
For example;
Client1 --CALL--WCF--> Metod_A
Client2 --CALL--WCF--> Metod_A
Metod_A spend 20 second for process. Client2 wait 20 second due to Client1.
I try, InstanceContextMode; PerSession, PerCall or Single. And I try ConcurrencyMode = ConcurrencyMode.Multiple but all of them give same result. Allways Client2 wait 20 second due to Client1.
How can I remove waiting time.
Note: Metod_A retrun value. So I can't use IsOneWay=true etc... And I don't want use thread.
Thanks...
modified on Sunday, October 18, 2009 5:46 PM
|
|
|
|
|
dataminers wrote: Metod_A spend 20 second for process
I strongly recommend you consider a redesign of your service. A service that takes 20 seconds to execute is far from scaleable as you've already seen with just 2 concurrent clients.
You should consider converting the service to one that requests that the operation be performed (in a separate thread) and returns quickly (after submitting the request). You'll also need APIs to check if the request has finished, and get the returned results (or error status).
/ravi
|
|
|
|