|
Luc Pattyn wrote: you want to compare two strings in a special way?
what class could possibly help you?
Oooh oooh! Is it CompareTwoStrings.InASpecialWay ?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
you're giving it away!
|
|
|
|
|
Use string.Compare .
var part = from item in Partlists.Descendants("Partx")
where string.Compare((string)item.Element("Part_name"), ex.Name, true) == 0
select item;
Best wishes,
Navaneeth
|
|
|
|
|
Thank you very much Navaneeth! That's what I was looking for!!
|
|
|
|
|
Hi,
I have a problem with VS2010beta2 and .NET Framework Client Profile, although I would expect the problem to be something to do with my inexperienced coding.
I have this block of code..
struct sGamePort
{
public string sgpProtocol;
public UInt16 sgpPortStart;
public UInt16 sgpPortEnd;
}
struct sGamePortItem
{
public string sgpName;
public List<sGamePort> sgpPortList;
}
List<sGamePortItem> sGames;
private sGamePort ParsePorts(string[] line)
{
sGamePort gp = new sGamePort();
gp.sgpProtocol = line[0];
int num = line.Count();
if (num == 2)
{
gp.sgpPortStart = Convert.ToUInt16(line[1]);
gp.sgpPortEnd = Convert.ToUInt16(line[1]);
}
if (num == 3)
{
gp.sgpPortStart = Convert.ToUInt16(line[1]);
gp.sgpPortEnd = Convert.ToUInt16(line[2]);
}
return gp;
}
Where line is a string array which essentially holds some tokens.
ie.
line[0] = "NAME"
line[1] = "JOHN"
line[2] = "YOUNG"
Now, in a seperate function I have
sGamePortItem pi = new sGamePortItem();
pi.sgpProtocol = "TCP";
pi.sgpPortList.Add(ParsePorts(strCMD));
This gives me a Null Reference Exception, so I changed it to this...
sGamePortItem pi = new sGamePortItem();
pi.sgpProtocol = "TCP";
sGamePort test = new sGamePort();
test = ParsePorts(strCMD);
pi.sgpPortList.Add(test);
Now, the error only occurs on the specified line above.. What am I doing wrong? Is it to do with me using the new keyword incorrectly? Or do I not use 'new'?
Any help would be appreciated as this has been confusing me for a few hours now, lol
Thanks again.
John
Yippee Kai Yai
Signed Polomint.......
|
|
|
|
|
The problem is that your line:
public List<sGamePort> sgpPortList;
should be:
public List<sGamePort> sgpPortList = new List<sGamePort>();
Need to assign a target to sgpPortList before you dereference it, hence the null ref exception.
|
|
|
|
|
Damn, I knew it would be something trivial...
Thanks for waking me up to a silly mistake,
EDIT:
Now I'm getting the error "cannot have instance field initializers in structs"...
Hmmm, this could be a pain...
EDIT AGAIN:
I realised what was wrong.. I hadn't been initialising the sGamePortItem in the list..
sGamePortItem pi = new sGamePortItem();
pi.sgpPortList = new List<sGamePort>();
Thank you for your help, it made me think more about the initialisation...
Yippee Kai Yai
Signed Polomint.......
modified on Thursday, December 3, 2009 2:09 PM
|
|
|
|
|
You need to initialize the list of the struct "sGamePortItem" before assigning the object.
|
|
|
|
|
Hi,
I am developing a web app in VB.NET 1.1. In some Webforms I call a showModalDialog child, but when I close it, the parent session is removed.
Please, how can I hold it?
Thanks in advance,
Jose Alvarez de Lara
|
|
|
|
|
Modal dialogues can't refer to their parent using opener. You need to pass a reference to the parent in the second parameter to showModalDialog.
|
|
|
|
|
Hi Puri,
That is what I did. And I maintain a conversation between then parent and the child.
I am thinking if it is possible to send the parent session to the child and bring it back
to the parent when close the child.
Thanks for your interesting,
Jose
|
|
|
|
|
Hello,
There are two articles here in the Code Project. I am talking about "Those Crazy Popups" and "ASP.Net Modal Window Server Control". I am looking for something like them, but I need to fix those articles into my issue.
Any help will be appreciate.
Regards,
Jose
|
|
|
|
|
Hi,
I have found the answer googling.
It is enough putting
Response.Cache.SetCacheability(HttpCacheability.NoCache)
in the Page_Load of pop up window.
On the other hand here is the code snippet,
Page1.aspx
function DoDo(){
window.showModalDialog("Show.aspx","aa");
}
<asp:linkbutton id="LinkButton1" onclientclick="DoDo()" runat="server">LinkButton
protected void Page_Load(object sender, EventArgs e)
{
Session["AA"] = "have a good day!";
}
Show.aspx
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AA"] != null)
Response.Write(Session["AA"].ToString());
else
Response.Write("NULL..........");
}
I hope this help to other people.
Regards,
Jose
|
|
|
|
|
Hello,
I have folllowing problems on a customized DesignSurface. I Load and save the design in a sort of XAML File (proprietary).
- wenn I copy and Paste a TabControl, Order of TabPages is wrong (reversed). Objects come in the wrong order in the Serialize method of my IDesignerSerializationService implementation.
- Wenn I copy and paste a Context menu, the Paste operation fails for the menuitems. It says "Toolstripmenuitem cant be insert in Container of type Form".
- I Have IExtenderprovider on some controls (ToolStrip). How can I handle that ? wen I Paste, The Design surface searches an object with the same name on the destination surface.
Thanks
|
|
|
|
|
No one knows something ?
|
|
|
|
|
I've been trying to find a webpage containing the syntax of connection strings, especially for Tab, Space, and multiple delimiters. Right now, I am trying to query a text file that is space delimited where I treat consecutive delimiters as one.
The following code snippet is from my connection string in C++ .NET
Extended Properties=\"text;HDR=Yes;FMT=Delimited(' ')\""
Do you know what the syntax should be and where I can find a page with a list of the delimiters with syntax? I have examples for csv format, but have not found other examples on google yet.
|
|
|
|
|
Have you tried www.connectionstrings.com/[^]?
I have not checked for text file connections, but that site has helped me when I can't remember connection string syntax.
|
|
|
|
|
Yes, I already have checked connectionstrings.com. They have examples with Tab, semi-colon, and comma. I have not gotten a space delimiter to work however.
|
|
|
|
|
I want to save variable Values to a file and start another application when unhandled error occurs.
Does anyone has any idea?
Regards Mahdi Ghiasi
|
|
|
|
|
mahdigh wrote: Does anyone has any idea?
About what exactly?
Writing things to a file shouldn't be much of a problem. There's an event[^] that's triggered when an unhandled exception occurs. Starting an application is done via Proces.Start [^].
That about covers it, I guess
I are Troll
|
|
|
|
|
Where is Proces.Start in VB?
Mahdi Ghiasi
|
|
|
|
|
mahdigh wrote: Where is Proces.Start in VB?
In VB.NET you'll find it in the diagnostics namespace.
If you're using VB6, then there won't be a namespace. You'd use the built-in Shell function, or call the CreateProcess [^] API.
Hope this helps
I are Troll
|
|
|
|
|
Where is diagnostics namespace in VB.NET?
Mahdi Ghiasi
|
|
|
|
|
It's under the System namespace. You can call it like this;
System.Diagnostics.Process.Start(@"c:\Them_Variables_Be_Here.txt")
That would open the file in the application that's associated with text-files, which defaults to Notepad. A more elaborate example can be found on MSDN[^].
Enjoy
I are Troll
|
|
|
|
|
Hi,
I am trying to create an application in VB.net which requires the user to enter some information into a form as soon as he unlocks his system, i am able to popup the form as soon as the user unlocks, however it allows the user to access the desktop, can anybody help me to create a form that will allow the user to access the desktop only after closing the form
Thanks for any help in this regards.
|
|
|
|