|
Forgot how to use code blocks already?
Did you get your previous xml problem working in the end, didn't hear any more in the thread?
|
|
|
|
|
Hi Dave,
Thanks. I think you are talking abt the function i ve written..without returning that function..with function name..
I have that line in my code..since it is big code i just copy pasted only first part and end function missed to paste last to previus line.
Here is the function:
Function RemoveAmpersands(AnyStr As String) As String
Dim MyPos As Integer
' replace Ampersands (&) with plus symbols (+)
MyPos = InStr(1, AnyStr, "&")
Do While MyPos > 0
Mid(AnyStr, MyPos, 1) = "+"
MyPos = InStr(1, AnyStr, "&")
Loop
RemoveAmpersands = AnyStr
End Function
If you are trying to say something pls reply..
Thanks
Priya
|
|
|
|
|
priyaahh wrote: I am using the following funtion to replace &.
Your code replaces all the ampersands (&) in a string with plus (+) which is what you say you want to do.
Then you say:
priyaahh wrote: But the above function replacing with +. But I wanted to display in the browser as & only.
...so, what exactly do want to achieve?
BTW this would do the same thing in one line.
Dim newStr As String = AnyStr.Replace("&", "+")
It’s not because things are difficult that we do not dare, it’s because we do not dare that things are difficult. ~Seneca
|
|
|
|
|
Hi
Thanks. Yes my code is replacing & with +. Because if i display as & in XML it is giving error. But i wanted to display & as & not as +. Is there any wy to display & in XML browser.
Regards,
Priya.
|
|
|
|
|
Then riced's answer (above) is what you need. I found this with Google http://articles.techrepublic.com.com/5100-10878_11-5032714.html[^]
Here's an extract:
Ampersand—&—&
greater-than—>—>
less-than—<—<
apostrophe—'—'
quote—"—"
If I may say so, you seem to make a lot of work for yourself!
It’s not because things are difficult that we do not dare, it’s because we do not dare that things are difficult. ~Seneca
|
|
|
|
|
Hi Annie,
Thanks for your reply.
I tried using & but when i use this, I am not getting any output and the application is processing.....and not stopping..I have to use TaskManager and End the application.
Kindly help.
Regards,
Priya.
|
|
|
|
|
OK, here are two code snippets that illustrate what you need.
<p>
You can find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&clcid=0x409"
title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>.
</p>
After the 152368 you see ampersand(&), letter a, letter m, letter p then semi-colon(;)? That is what is required in place of the &. This will do the replacement for you:
Dim newStr As String = oldStr.Replace("&", "&")
It’s not because things are difficult that we do not dare, it’s because we do not dare that things are difficult. ~Seneca
|
|
|
|
|
Dim o = IIf(True, "1", CType("", Decimal))
This gives you an invalid cast exception.
weak..
|
|
|
|
|
i always wanted to know that......................
|
|
|
|
|
I bet you still want to know why that happens?
|
|
|
|
|
Tune in next week to see the next thrilling installment...
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
|
Yeah, and ....?? It doesn't surprise me in the least.
You cannot convert String.Emtpy to a Decimal type and, the way you coded it, IIF can either return a String ("1") or Decimal. The compiler can't figure out what the primary type of the return value is supposed to be and there is no implicit conversion available to go from String to Decimal. If you has IIF returning two different numeric types, say Integer and Short, this wouldn't be a problem because a Short can be upsized into an Integer, so the return type for IIF would be Integer.
|
|
|
|
|
So why can I compile this then?
In c# you can't...
|
|
|
|
|
C# is a real programming language.
VB/VB.NET isn't by default; you can improve things a bit by starting with OPTION STRICT ON .
|
|
|
|
|
Does C# have a CType[^] function? I'd guess that C# checks your cast at compiletime, whereas the CType function may throw runtime errors.
They're not the same languages, so behaviour doesn't have to be similar
I are Troll
|
|
|
|
|
I thougth IIF was something special, like if the condition is true ,the false part is never reached.
But it's nothing more than this:
Public Function IIF(ByVal condition As Boolean, ByVal truepart As Object, ByVal falsepart As Object) As Object
If condition Then
Return truepart
Else
Return falsepart
End If
End Function
|
|
|
|
|
Yep. IIF is a function that returns a single type, just like any other.
The reason why VB.NET let's you get away with some of this stuff at compile time is because, by default, VB will try to provide implicit conversions to what it thinks the expected types should be where as C# will not.
Like Luc said, the way to avoid this is Option Strict On .
|
|
|
|
|
In VB9 (VS 2008) and beyond use the new VB ternary operator (which provides exactly the same behavior as the ternary conditional operator in C#, C++, and Java) rather than the 'IIf' function:
Dim o = If(True, "1", CType("", Decimal))
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
An empty string cannot be converted to a Decimal so the conversion throws an error. Change the empty string to "0" and it should work just fine. If you need it to return a different type (this has the smell of a homework project) try replacing the CType block with a different value, like 0.0 or Nothing .
|
|
|
|
|
Hi,everyone! I used a treeview control in my application, I wanted to make treenodes like a href ,for example ,when my mouse move over it ,the font and color of treenode changed . I've done this in mousemove event. The code was like this
Private Sub treeQiaoTi_MouseMove1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles treeQiaoTi.MouseMove
Dim info As TreeViewHitTestInfo
info = treeQiaoTi.HitTest(e.X, e.Y)
If (info.Node IsNot Nothing And m_nodePre IsNot info.Node) Then
info.Node.ForeColor = Color.Violet
info.Node.NodeFont = New Font("微软雅黑", 10.5, FontStyle.Underline)
If (m_nodePre IsNot Nothing) Then
m_nodePre.ForeColor = Color.DarkBlue
m_nodePre.NodeFont = New Font(info.Node.NodeFont, FontStyle.Bold)
End If
m_nodePre = info.Node
End If
End Sub
But now, my question is ,when mouse move over unchecked treenode, I don't want them change color and font; I means how could judge treenodes whether checked or not ?
Please give me some help and suggestions !Thx a lot !
|
|
|
|
|
Every TreeViewItem has a IsSelected property. I guess you could use that to check if that particular node is checked or not.
|
|
|
|
|
Hi,Abhinav,I've done what I wanted with this judge:
If e.Node.Checked Then
First judge the treenode whether checked or not, if it checked, changed its color!
Still thank you for your suggestion!
|
|
|
|
|
Hi all.
I am using form.
there i want a tab control having 2 tabs.
In that tab control i want to add two forms in 2 tabs.
how to add a tab control in VB6.0 and how to use it?
|
|
|
|
|
You would need a reference to the microsoft tabbed dialog control (TabCtl32.ocx). Right click components -> "Components..." and add it in the Component dialog.
Good luck!
PURPOSE: Delays program execution until designated condition is indicated.
|
|
|
|