|
I have a combobox on my form called cboLang. When the selectedindexchanged fires I run a routine that goes out to the database and changes the labels to the language requested. Then it loads up the combobox with that language's form of the name of each possible language (i.e., if the user selected French it would put "Anglais" in the combobox instead of "English").
What I'd like to do next is ensure that the language the user selected is the one selected in the combobox. However, whenever I do this it fires the selectedindexchanged event again which starts everything all over and it gets into an infinite loop.
How can I set the selected item without it firing the selectedindexchanged event?
Denise "Hypermommy" Duggan
|
|
|
|
|
2 possible solutions that I see:
0) Don't do the code that changes everything in the 'selectedindexchanged' event.
Do it in a 'Save settings' button or so.
1) Maintain a boolean variable 'ImWorking' (dummy name ) (on form level). While your code is running change this boolean to 'True'. First thing in your 'selectedindexchanged' event is check this boolean. If the boolean is true than exit the event (exit sub)
My choice would be first one.
This allows for the user to misclick without having to wait for the language change to have ran its course.
|
|
|
|
|
You have possibly two ways to do this...
1. use SelectionChangeComitted event (recommended)
2. use some global variable Flag that u set to 'true' once all the comboBox is filled up... before comboBox is completely filled..this flag should remain 'false'... later on in ur code... just check if the flag is set to 'true' before doing what ever u do upon item selection.
Enjoy!
|
|
|
|
|
SelectionChangeCommitted was exactly what I need!! Thanks!!!!! Never even knew that it existed but it's just what I needed.
Denise "Hypermommy" Duggan
|
|
|
|
|
Enjoy!
|
|
|
|
|
An excellent solution. I too was unaware of this event.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi All,
I have two application.First one is Used for Calling Second Application. Second runs alwase with Admin Rights.
When I am trying to start process of Second Application then it reqire admin rights with Passord and Cancel Button.
Then How to check it in first application The second application is run by Admin rights or not.
Thanks
If you can think then I Can.
|
|
|
|
|
From MSDN[^];
Console.WriteLine("{0}? {1}.", WindowsBuiltInRole.Administrator,
myPrincipal.IsInRole(WindowsBuiltInRole.Administrator));
I are troll
|
|
|
|
|
Hi,first say that if the place for this post isn't correct, sorry but I don't if the correct place is within Java,Vb o Winform xD
Create a usercontrol with a single textbox and one property that set the textbox and get the value of the textbox. This usercontrol is embedded in HTML page. I can change the value of the textbox perfectly but isn't possible access to usercontrol with javascript.
When I create the instance to the usercontrol can get access but out the object tag is impossible .... my code is this ...
VB CODE:
<pre>
Public Class SerialPort
Inherits System.Windows.Forms.UserControl
Public Property Age() As String
Get
Return Me.Age.Text
End Get
Set(ByVal Value As String)
Me.Age.Text = Value
End Set
End Property
End Class
</pre>
HTML CODE:
<pre>
<html>
<body>
<form name="form1">
<object id="SerialPort" classid="UserSerialPort.dll#UserSerialPort.SerialPort" height="399" width="651">
<param name="age" value="48">
</object>
</body>
<br/>
<input type="button" name="btage" value="Age" onClick="getage();">
script language="javascript">
var objserial;
objserial = document.getElementById("Serialport");
function getage()
{
var quedevuelve;
quedevuelve = objserial.age;
alert(quedevuelve);
}
</script>
</form>
</html>
</pre>
The first part, work correctly, send the value "age" with value 48 and this is reflected in the usercontrol, but the next call to function javascript return undefined, I haven't found any solution for it ...
If anyone can help I would greatly appreciate it, a greeting.
modified on Tuesday, June 9, 2009 7:35 AM
|
|
|
|
|
tdc_david wrote: Hi,first say that if the place for this post isn't correct, sorry but I don't if the correct place is within Java,Vb o Winform xD
um.... ASP.NET forum ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
ASP.NET no, because the page is only HTML with javascript....
|
|
|
|
|
So that makes you ask in the VB.NET forum??
|
|
|
|
|
Because my code had two parts, the first is in vb.net and second is html/javascript.
I would appreciate that instead of questioning the place of the wire we can concentrate more on the problem ... Thanks.
|
|
|
|
|
Your problem has to do with JavaScript and ASP.NET, not VB.NET. Even after writing VB code for the last 13 years, I couldn't tell you what's wrong with it. It'll work perfectly in the Windows Forms application. I have no idea what mechanism JavaScript uses to communicate with your object.
|
|
|
|
|
1 - The Situation:
I'm Using "Visual Basic 6"
I'm Using "Webbrowser Control"
I'm Using "Microsoft HTML Object Library"
====================================================
2 - What I Want:
*Acees objects (buttons, links, etc) on a IFRAME
*Get all links for example, click in links, etc...
This is easy... but...
===================================================
3- THE PROBLEM:
The page A is in www.abc.com
The page B is in www.xyz.com
The Page A contains one iframe to page B
I Can't acess elements in Iframes with diferrent domains using normal methods.
====================================================
4 - Example:
PAGE A.html (www.abc.com/PageA.html) ==>
<html>
<body>
THIS IS THE PAGE A!<Br>
PAGE A contains one Iframe to PAGE B!<br>
<Iframe id="PageB" name="PageB" src="http://www.xyz.com/PageB.html">
</body>
</html>
====================================================
For example, if a try to get links of page B (iframe) pufff...
"{"Access Denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"}"
====================================================
5 - The phrase for the more experienced are:
Nothing is impossible! you know!
How can I then perform this procedure?
Thanks
====================================================
|
|
|
|
|
Hmmm,
This looks like a distinct case of cross site scripting (XSS) security, and for security reason is probably being blocked by the browser (WebBrowser control)
Just a thought as I know nothing about XSS.
Dave
|
|
|
|
|
Probably!
But if you notice, some extensions like:
* IE Developer Toolbar (IE)
* Firebug (FF)
can access any element.
This shows what is possible.
|
|
|
|
|
I would suspect that is because they are browser plug-ins that can interface with all data the browser sees.
You are talking about a web page reading another web page DOM.
[editing now i have re-read your post again to undetstand the problem more!]
Can you read the source attribute of the iframe? if so why not read that directly and access the source data directly?
modified on Tuesday, June 9, 2009 9:59 AM
|
|
|
|
|
You Know any possible solution?
|
|
|
|
|
Hello friends,
I tried converting lower case char to upper case and vice versa
it works fine with the following code
Dim abc As String
Dim xyz As String = String.Empty
Dim a As Char
Console.WriteLine("Enter The String")
abc = Console.ReadLine()
For Each a In abc
Dim b As Char
If Asc(a) > 64 And Asc(a) < 91 Then
b = Chr(Asc(a) + 32)
ElseIf Asc(a) > 96 And Asc(a) < 123 Then
b = Chr(Asc(a) - 32)
End If
xyz = xyz + b
Next
Console.WriteLine(xyz)
Console.ReadLine()
case 1 Input : ABCdef
Output: abcDEF
case 2 Input :ABC def GHI
Output:abccDEFFFghi
Desired Output:abc DEF ghi
The issue is maintaining the whitespace between the strings, with the current code the the whitespaces are replaced by the previous charcter in the output.
I like the whitespaces between the strings to be maintained .
Thanks In Advance
Praveen
|
|
|
|
|
Member 4514218 wrote: If Asc(a) > 64 And Asc(a) < 91 Then
b = Chr(Asc(a) + 32)
What an ugly, ugly mess. Char.IsAlpha is what you need, from memory. And Char.ToLower.
How about abc = abc.ToLower()
Member 4514218 wrote: If Asc(a) > 64 And Asc(a) < 91 Then
b = Chr(Asc(a) + 32)
ElseIf Asc(a) > 96 And Asc(a) < 123 Then
b = Chr(Asc(a) - 32)
End If
xyz = xyz + b
The core flaw in your logic is that you need another else.
else
b = a
Otherwise, anyting that is not a lower or uppercase character, is lost.
you look like you're coming from VB6, that's where all the nasty habits are coming from. Forget VB6, learn to use VB.NET properly. And, learn to use the debugger, if you stepped through this code, you'd have seen in no time what the issue was.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
very simple...just add one 'Else'... as below...!
Dim abc As String
Dim xyz As String = String.Empty
Dim a As Char
Console.WriteLine("Enter The String")
abc = Console.ReadLine()
For Each a In abc
Dim b As Char
If Asc(a) > 64 And Asc(a) < 91 Then
b = Chr(Asc(a) + 32)
ElseIf Asc(a) > 96 And Asc(a) < 123 Then
b = Chr(Asc(a) - 32)
Else
b = a
End If
xyz = xyz + b
Next
Console.WriteLine(xyz)
Console.ReadLine()
Enjoy!
|
|
|
|
|
Thanks binjafar
It is simple and effective
Regards
Praveen
|
|
|
|
|
my pleasure....
|
|
|
|
|
Dim ca As Char() = TextBox1.Text.ToCharArray
TextBox1.Text = ""
For Each c As String In ca
Select Case Char.IsUpper(c)
Case True
TextBox1Text &= c.ToLower
Case False
TextBox1.Text &= c.ToUpper
Case Else
TextBox1.Text &= c
End Select
Next
My advice is free, and you may get what you paid for.
|
|
|
|