|
Could any one please help me to get the real use of Window handlers. And Please give me an example to use it in ASP.Net application.
Thank you.
VB.Net,ASP.Net, VB, ASP, Database
|
|
|
|
|
What do you mean by "Window handler"?? There are Window "Handles", which is just a numeric identifier of a Window for use in Win32 applications. They don't apply to ASP.NET apps. There are also window message handlers, but again, they don't apply to ASP.NET apps.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Keep the conversation in the forums. Do NOT hit the Email link. I don't care what your personal email is and will not respond to it.
Mr. Dave
I am sorry I put the correct question or not. What I want is here clearly. Thank you if you could give me the reply immediately.
"I am able to open a seperate window using buttin click and few lines of java/vb script code. But I am unable to pass the values of the second or child window browser to the first browser or the parent browser. Can any one you advice me or give me a little much of code to achieve this task.
you can mail me to my personnal email: xxxxxxxx@gmail.com, xxxxxxxxxxxxx@akebonosoft.com"
I put this question because, I can do it using window(event) handlers in Windows application. But in ASP.Net I dont know how to do it.
Aleem.
Passing values between browser windows has nothing to do with the .NET Framework. It's done entirely in Java script, which is something outside of my realm of experience. You might want to post this question in the ASP.NET Forum.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
Can someone tell me if there is a simple way of finding all descendents of a given class in an application?
Or, is it best to use reflection to run through all classes in the currently loaded assemblies and check if they inherit from the class that I'm interested in?
In essence, what I want to do is this:
I have a base class : MyBaseClass
I inherit 'N' classes from it : MyNewClass1 , MyNewClass2 ... MyNewClassN
A 'plugin' assembly inherits some more : TheOtherClass1 , TheOtherClass2
I'd then like to be able to get a list of all the loaded classes that inherit from MyBaseClass ...
Cheers
Shaun
|
|
|
|
|
A class contains no information about it's descendents. You have to check each class for inheritance.
---
b { font-weight: normal; }
|
|
|
|
|
That's kind of what I thought. I ended up going through the classes in each assembly and checking that they were descended from the correct class.
Thanks
Shaun
|
|
|
|
|
hi all
is there any idea about jabber messanger,,
i want to create my own jabber chat server and client messanger ,, whre to statrt ,,, what is required ? can any one explain me the right way to follow ,, any help plz
thanks in advance
hello
|
|
|
|
|
The right way is to scope out the project from a "blue sky" point of view and work your way down, getting more detail on every level.
|
|
|
|
|
We see more and more text boxes that contain a faded text to help the user enter the right information. A good example you could have a text box wuith a label "Email" and faded in the text box we could have something like "YourAddress@yourdomain.com" to help the user. Normally as soon as data in entered , this information disapears and is never seen again. I think it is called shadowing. .NET Windows forms doesn't seem to support this, or did I miss something.
|
|
|
|
|
A website that has a control like what you are looking for is: XP Common Controls (XPCC)[^]
This site has a control that can give the shadowed text called a XPCueBannerExtender. The description on the site: The CueBannerExtender allows you to display a grayed text inside a textbox or group box that will vanish when the control gets the focus. Because this is an extender control you can simply place it onto your form and add the CueBannerText to display to each textbox and groupbox you wish.
However if you do use other controls on this site such as the XPLetterBox and XPLoginEntry. Please consider using my XP Logon Control[^] that is based off of both of the controls and adds some other user interface enhancements.
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
This effect can be fairly easily done.
Use the designer to add some sample text like email address and change the coloer to your light grey color. The designer will look like something lke:
Me.TextBox1.ForeColor = System.Drawing.Color.Silver
Me.TextBox1.Text = "Sample text"
As soon as the user starts to type in the text box you want the text to clear and the color to change. So handle a couple possible events like this:
Private m_bFirst As Boolean = True
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If m_bFirst Then
'clear the text
TextBox1.Text = ""
TextBox1.ForeColor = Color.Black
End If
End Sub
Private Sub TextBox1_MouseDown(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles TextBox1.MouseDown
If m_bFirst Then
'clear the text
TextBox1.Text = ""
TextBox1.ForeColor = Color.Black
End If
End Sub
I have just made these changes to the form where I was using the text box. If you wanted to use this style more then once you could make a custom control.
|
|
|
|
|
I wanted to avoid wriring but it's not too long to do so let's get busy !
|
|
|
|
|
Hi.
I need to ecncrypt password and store it in DB for later use. How do I do that?
I use System.Security.Cryptography.RijndaelManaged to encrypt password (please see code below). Here's where I'm stack. How do I save it in DB and how do I decrypt it later on as well? I generate IV and key to encrypt password but I'm sure I need to keep them for later use somehow. I will need to decrypt password back when user returns.
Please help.
<br />
Dim original As String = txtPassword.Text<br />
Dim myRijndael As New RijndaelManaged<br />
Dim encrypted() As Byte<br />
<br />
Dim key() As Byte<br />
Dim IV() As Byte<br />
<br />
'Create a new key and initialization vector.<br />
myRijndael.GenerateKey()<br />
myRijndael.GenerateIV()<br />
<br />
'Get the key and IV.<br />
key = myRijndael.Key<br />
IV = myRijndael.IV<br />
<br />
key = myRijndael.Key<br />
IV = myRijndael.IV<br />
<br />
'Get an encryptor.<br />
Dim transform As System.Security.Cryptography.ICryptoTransform<br />
transform = rmcrypto.CreateEncryptor(key, IV)<br />
encrypted = transform.TransformFinalBlock(encoder.GetBytes(original), 0, encoder.GetBytes(original).Length)
|
|
|
|
|
If you create a new key for each time you encrypt a password, you have to store the key along with the encrypted password. Then it's not really any point in encrypting it, is there?
A common way of handling passwords is to not store them at all, but only store a hash code of the password. That way noone can ever decrypt the password. When you need to check the password, you get the hash code of the entered password and compare it to the stored hash code.
The GetHashCode method of the string class is not suitable for long term storage, though. You have to use a consistently defined algorithm, like for example MD5.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks. I kinda thought about it too. Here's what I came up with
Function HashPassword(ByVal password As String) As String<br />
Dim hashedPassword As String<br />
Dim hashProvider As SHA256Managed<br />
Try<br />
Dim passwordBytes() As Byte<br />
Dim hashBytes1() As Byte<br />
Dim hashBytes2() As Byte<br />
passwordBytes = System.Text.Encoding.Unicode.GetBytes(password)<br />
hashProvider = New SHA256Managed<br />
hashProvider.Initialize()<br />
hashBytes1 = hashProvider.ComputeHash(passwordBytes)<br />
hashBytes2 = hashProvider.ComputeHash(hashBytes1)<br />
hashedPassword = Convert.ToBase64String(hashBytes2)<br />
Finally<br />
If Not hashProvider Is Nothing Then<br />
hashProvider.Clear()<br />
hashProvider = Nothing<br />
End If<br />
End Try<br />
Return hashedPassword<br />
End Function
|
|
|
|
|
One way is to specify the key & IV rather than generating them. Then you use the same values to decrypt.
e.g.
myRijndael.Key = keyBytes ' 32 bytes<br />
myRijndael.IV = ivBytes ' 16 bytes
"For fifty bucks I'd put my face in their soup and blow." - George Costanza ~ Web SQL Utility - asp.net app to query Access, SQL server, MySQL. Stores history, favourites.
|
|
|
|
|
I see. Do you have any example of how I can create these?
Can they be random (I mean different)?
Thanks,
|
|
|
|
|
Yep they're different.
One common way is to use the PasswordDeriveBytes class.
E.g. (in C#):
byte[] key = new PasswordDeriveBytes("secret_pass", new byte[]{ 21, 5, 85, 200, 43, 65, 44 }).GetBytes(32);<br />
byte[] iv = new PasswordDeriveBytes("secret_pass", new byte[]{ 21, 5, 85, 200, 43, 65, 44 }).GetBytes(16);
BTW those numbers are random. You can make up your own byte array. It's known as the salt .
"For fifty bucks I'd put my face in their soup and blow." - George Costanza ~ Web SQL Utility - asp.net app to query Access, SQL server, MySQL. Stores history, favourites.
|
|
|
|
|
Thanks man. I look into this. I found one way as you can see in my reply to another guy but would really like to finish what I've started.
Thanks again.
|
|
|
|
|
Hello My Dears............
I have downloaded "Network Sniffer & Connection Analyzer" code but get problem in running the code in "Microsoft Visual Studio 2005 Express Edition".....
PLZ Help me in running this code(Give details for running)..............Thanks.
khalid mahmood
|
|
|
|
|
hazarian wrote: Give details for running
How about giving details of what problem you are having?
|
|
|
|
|
This code consists of three Projects i-e "Port scanner,Sniffer,SnifferUI"......What should be the exact way of running these three projects.
khalid mahmood
|
|
|
|
|
Hi,
I've got a combobox to which I add objects.
I would like to have one specifiec object selected.
Some of the objects contain the same DisplayMember but differ in other aspects = index.
When the objects that do not have dublicates are selected there is no problem in selecting correct item as selected, but when the object has DisplayMember dublicates the first displayed items is always selected no matter what SelectedIndex or SelectedItem is assigned.
Any tip?
ToDo
|
|
|
|
|
I looked at DisplayMember under the ComboBox entry in MSDN for VS2005 and there was an example program (for ListBoxes) which I subtley changed to be a ComboBox. I also modified the sample data to contain duplicate DisplayMember values. It seems to work perfectly as far as I can tell, but maybe I am missing your point?
Just copy and paste all this code into a WindowsApplication.
HTH - Des
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace WindowsApplication3
{
public partial class Form1 : Form
{
//private ListBox ListBox1 = new ListBox(); // Just for our test
private ComboBox ListBox1 = new ComboBox();
private TextBox textBox1 = new TextBox();
public Form1()
{
this.ClientSize = new Size(292, 181);
this.Text = "ListBox Sample3";
ListBox1.Location = new Point(24, 16);
ListBox1.Name = "ListBox1";
ListBox1.Size = new Size(232, 130);
textBox1.Location = new Point(24, 160);
textBox1.Name = "textBox1";
textBox1.Size = new Size(240, 24);
this.Controls.AddRange(new Control[] { ListBox1, textBox1 });
// Populates the list box using DataSource.
// DisplayMember is used to display just the long name of each state.
ArrayList USStates = new ArrayList();
USStates.Add(new USState("Alabama", "AL"));
USStates.Add(new USState("Washington", "WA"));
USStates.Add(new USState("Washington", "W1")); // Duplicate DisplayMember
USStates.Add(new USState("West Virginia", "WV"));
USStates.Add(new USState("Wisconsin", "WI")); // Duplicate DisplayMember
USStates.Add(new USState("Wisconsin", "W1"));
USStates.Add(new USState("Wyoming", "WY"));
ListBox1.SelectedValueChanged += new EventHandler(ListBox1_SelectedValueChanged);
ListBox1.DataSource = USStates;
ListBox1.DisplayMember = "LongName";
ListBox1.ValueMember = "ShortName";
}
private void ListBox1_SelectedValueChanged(object sender, EventArgs e)
{
if (ListBox1.SelectedIndex != -1)
textBox1.Text = ListBox1.SelectedValue.ToString();
}
}
public class USState
{
private string myShortName;
private string myLongName;
public USState(string strLongName, string strShortName)
{
this.myShortName = strShortName;
this.myLongName = strLongName;
}
public string ShortName
{
get
{
return myShortName;
}
}
public string LongName
{
get
{
return myLongName;
}
}
public override string ToString()
{
return this.ShortName + " - " + this.LongName;
}
}
}
|
|
|
|
|
Hi,
thanks for the reply.
Try chaning this code part, I get the the first Washington selected.
// Populates the list box using DataSource.
// DisplayMember is used to display just the long name of each state.
ArrayList USStates = new ArrayList();
USState defaultSelection = new USState("Washington", "W1"); //New
USStates.Add(new USState("Alabama", "AL"));
USStates.Add(new USState("Washington", "WA"));
USStates.Add(defaultSelection); // Duplicate DisplayMember //Changed
USStates.Add(new USState("West Virginia", "WV"));
USStates.Add(new USState("Wisconsin", "WI")); // Duplicate DisplayMember
USStates.Add(new USState("Wisconsin", "W1"));
USStates.Add(new USState("Wyoming", "WY"));
ListBox1.SelectedValueChanged += new EventHandler(ListBox1_SelectedValueChanged);
ListBox1.DataSource = USStates;
ListBox1.DisplayMember = "LongName";
ListBox1.ValueMember = "ShortName";
ListBox1.SelectedItem = defaultSelection; //New
Regards,
ToDo
|
|
|
|