|
hi,
you can send your string in comma separated way
for ex.
port.WriteLine("1" + "," + txt_name.Text);
and while receiving it you can split string on comma delimeter and store it in array.
for ex.
string []strarr=strGetString.Split(',');
where strGetString is a string variable in which you receive string data.
hope this works.
|
|
|
|
|
thxx
but how do i check on 1 and 2
i think strarr[0] contains "1" and strarr[1] the rest of the text right?
so do just do this:
string strGetString = ReadLine();
string[] starr=strGetString.Split(',');
if (strarr[0]=="1")
{
textboxname.text = starr[1];
}
grz
|
|
|
|
|
loo
its working just fine; ive implemented it in a database
so everytime i get a name and adress via com its added in a new row in the right column
thxx
|
|
|
|
|
hi,
your wellcome!
Nitin...
|
|
|
|
|
Has anyone ever try to upload file from behind a firewall to a HTTPS site that use SSL certificate?
Thank you in advance.
Thuy
thuybui@msn.com
|
|
|
|
|
|
hi all,
I have a xml file like this
<code>
<?xml version="1.0" encoding="utf-8" ?>
<app-settings>
<sqlconnection string="sql" />
<generate-interval value="" />
<monitors>
<file filename="test.file" />
</monitors>
<templates>
<template xsl="hello1.xsl" outputhtml="hello1.html" xmldata="hello1.xml"
sqlquery="select top 10 * from table1"
linkurl="http://www.test.com/query.aspx?linkid=%aa%"/>
<template xsl="hello2.xsl" outputhtml="hello2.html" xmldata="hello2.xml"
sqlquery="select top 10 * from table1"
linkurl="http://www.test.com/query.aspx?linkid=%aa%"/>
</templates>
</app-settings>
</code>
then I want get and modify the app-settings/monitors/file attribute like 'filename'.
how to do it?
I tried this code, but it doesn't work.
<code>
XmlDocument doc = new XmlDocument();
XmlNode node = doc.SelectSingleNode("/app-settings/templates/template");
if (node != null)
{
Console.WriteLine("ok");
}
else
{
Console.WriteLine("error");
}
</code>
Thanks for your help.
|
|
|
|
|
I forgot this
<br />
doc.Load("123.xml");<br />
|
|
|
|
|
First of all "it doesn't work." isn't very descriptive. So the next time explain in more detail what's wrong.
To modify the app-settings/monitors/file node you should select it:
XmlNode node = doc.SelectSingleNode("/app-settings/monitors/file");
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks for your reply.
Stefan Troschütz wrote: First of all "it doesn't work." isn't very descriptive. So the next time explain in more detail what's wrong.
There is no any exception in my code.
It's just get a null object. and I didn't know why.
Then I found that I didn't 'doc.Load()' before use 'SelectSingleNode' method.
|
|
|
|
|
I am using Visual Studio 2005 and need some methods that are new in .NET2.0, but they don't show up in the code completion list. The one i am looking for is ListBoxt.RefreshItems(). How do I use this?
I have filled a lixtbox with objects that have a ToString() method. I am updating the output for the ToString() from a textbox, but the new text is not shown in the listbox. Does anyone know how to update the listbox without removing and re-adding all the elements?
- Atle
|
|
|
|
|
Did you click on the All tab at the bottom of the Intellisense window? You can still use the method. The list is just being filtered, by default, showing just the most commonly used properties/methods/events of the object.
What do you mean it doesn't update? What does youe code look like that is doing the update?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi there !
I have nested XML data and exact schema definition
Example:
<LEVEL1>
<ELEMENT1>Text....</ELEMENT1>
<ELEMENT2>More....</ELEMENT2>
<LEVEL2>
<ELEMENT3>Text....</ELEMENT1>
<ELEMENT3>More....</ELEMENT2>
<LEVEL3>
<ELEMENT3>Text....</ELEMENT1>
<ELEMENT3>More....</ELEMENT2>
</LEVEL3>
</LEVEL2>
</LEVEL1>
The XML file can be read into a DataSet object. During xml parsing by the DataSet.ReadXml () function, relations are automatically added. ID Columns are also added for the nested data levels, so that they can be tracked back to the top element.
I would like to bind each level to a different DataGrid, using the relation, so that when an element of level one is selected in the first datagrid, only the contained elements are displayed in the second datagrid, and so on. This requires at least two levels of relations that seem not to work with normal databinding., because the relations are only between two tables and as far as I found out I can not create a relation between two relations.
Please help, maybe there is a better way to display data like that with standard GUI components.
thanks
Christian
|
|
|
|
|
Hi there !
I have nested XML data and exact schema definition
Example:
<level1>
<element1>Text....
<element2>More....
<level2>
<element3>Text....
<element3>More....
<level3>
<element3>Text....
<element3>More....
The XML file can be read into a DataSet object. During xml parsing by the DataSet.ReadXml () function, relations are automatically added. ID Columns are also added for the nested data levels, so that they can be tracked back to the top element.
I would like to bind each level to a different DataGrid, using the relation, so that when an element of level one is selected in the first datagrid, only the contained elements are displayed in the second datagrid, and so on. This requires at least two levels of relations that seem not to work with normal databinding., because the relations are only between two tables and as far as I found out I can not create a relation between two relations.
Please help, maybe there is a better way to display data like that with standard GUI components.
thanks
Christian
|
|
|
|
|
Hi,
I am having a ListView component in my WinForm, when i add some images into it, it gives me a vertical scroll bar.
What i want is, the horizontal scrollbar instead of vertical.
Is there any way to hide the vertical scrollbars and display horizontal scrollbars?
|
|
|
|
|
I have a function GetVersion() that returns the version (e.g. 1.0) and I want to achieve this:
When I do MessageBox.Show(GetVersion()) to display 1.0 as a version.
When I do MessageBox.Show(GetVersion().Major()) to display 1
and when MessageBox.Show(GetVersion().Minor()) to display 0.
Parsing isn't issues here, but how to implement this GetVersion().SomeMethod().
I have tried this with the class with its methods:
public SomeClass GetVersion()
{
}
But this function required to return a value od type SomeClass and I need a string to return.
I don't know how to return a string with GetVersion() becouse GetVersion is type of SomeClass.
Or I can try by inheriting the Strings class and implement those two functions in that inherited class?
|
|
|
|
|
Your GetVersion() will need to return a type that implements GetMajor and GetMinor itself. Here is an example:
class VersionInfo
{
public int Major
{
get { return major; }
set { major = value; }
}
public int Minor
{
get { return minor; }
set { minor = value; }
}
private int major;
private int minor;
public override string ToSting()
{
return major + "." + minor;
}
}
class SomeClass
{
public static VersionInfo GetVersion()
{
VersionInfo temp = new VersionInfo();
temp.Major = 1;
temp.Minor = 0;
}
}
You can then use SomeClass.GetVersion() to get a VersionInfo , or SomeClass.GetVersion().Major or SomeClass.GetVersion().Minor
I modified your GetMajor() and GetMinor() functions to use properties. It's the preferred way in C# to access attributes of a class.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hmm. It refuses to work afterall.
In GetVersion() function it fails to compile with the error that it cannot be implicitly convert from string to VersionInfo.
Any ideas?
|
|
|
|
|
The implicit[^] conversion operator does just what you want. Try this piece of code
class VersionInfo
{
private string majorVersion = "1";
private string minorVersion = "0";
public static implicit operator string(VersionInfo versionInfo)
{
return versionInfo.majorVersion + "." + versionInfo.minorVersion;
}
public string GetMajorInfo()
{
return majorVersion;
}
public string GetMinorInfo()
{
return minorVersion;
}
}
Make GetVersion return an instance of VersionInfo and you're done.
|
|
|
|
|
This works, but it has something that its not like I wanted to do.
I read from Xml file version in GetVersion function. You have inicialized major and minor in VersionInfo class.
I tried to set the values like VersionInfo v = new VersionInfo; x.MajorInof = 1; and to use this instance as a return of a function, but this fails.
Can I somehow read Xml file in GetVersion function with this code or to read Xml file in VersionInfo class?
Sorry fot boder you...
|
|
|
|
|
I solved it.
I set Major and Minor to be type of int instead of string and now it works with VersionInfo v = new VersionInfo(); x.Major = 1; x.Minor = 0; set in GetVersion() function where I read from Xml.
Now I have to use ToString() when using GetVersion().Major or .Minor, but that's not the problem.
Thank you both for your time.
|
|
|
|
|
First, I have ComVisible set to true for the entire assembly.
I have (abstract) base class A. There are interfaces IA and IAEvents for accessing properties of this object and exposing events.
[ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(IAEvents))]
public abstract class A : IA
{
...
}
I then have a derived class B and an interface IB (IB also derives from IA).
public class B : A, IB
{
...
}
Given an instantiation of B, I can access (from COM) properties/methods defined in either IA or IB.
However, when I then add a IBEvents (deriving from IAEvents) and change class B to:
[ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(IBEvents))]
public class B : A, IB
{
...
}
I can no longer access methods/properties defined from A/IA. Only those defined at the B level. Commenting out the attributes on B will make it work, but of course the new events from IBEvents do not exist. Is there some wierd trick with regards to inheritance and COM that is preventing this? Is it still possible to do what I want? I intend to have a great many classes deriving from A each with their own unique set of properties and events in addition to the 'base' ones defined in A.
Ideas?
Adam Clauss
|
|
|
|
|
Hi,
I made a few textboxes where a user would put data in.
If the first box has data entered, it should enable the next textbox.
The problem is, what can i do if the user presses a few times the spacebar.
Because the next textbox will be enabled.
Thanks in advance!
|
|
|
|
|
You can trim the Text property just like you would trim a string (thats just what the Text property is).
I am not sure if that was your problem, though. It reads like you are referring to setting input focus to the next textbox? Please clarify.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
Hi Sebastian,
Maybe you understand the code better than my words
private void Textbox1_TextChanged(object sender, EventArgs e)
{
this.Textbox1.Text.Trim();
if (this.TBLicensePlateCar.Text == string.Empty)
{
MessageBox.Show("Nothing is typed", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
this.data = this.Textbox1.Text;
this.NextTextBox.Enabled = true;
}
}
One char is enough to enable the next textbox. But is shouldn't be a space.
|
|
|
|