|
Hi Aavesh ,
This is the code to validate User ID & Password from DataBase.
If u r using SQL
imports System.Data.SqlClient
Dim Command as SqlCommand
dim DR as SqlDataReader
Dim Con as new SqlConnection("Server=server name;DataBase=database name;User Id=login id; Password=password;")
write this code in a Button Click.
Dim strCommand as String ="Select * from Login_Table where UserName_Column= ' " & txtUser.Text & " ' and Password_Column= ' " & txtPassword.Text & " '"
Command = New SqlCommand(strCommand,Con)
Con.Open()
DR = Command.executeNonQuery()
Con.Close()
If DR.HasRows = True then
MsgBox("Welcome")
Else
MsgBox("User Name or Password invalid")
End If
Dr.Close
With Regards,
Chandan Kumar
|
|
|
|
|
Hi there
i want to move to the next tab on click of a button.
Other than the tabstrip button . Please help me to solve this.
bharath.s
|
|
|
|
|
Try:
Me.tabcontrolname.SelectedTab = nameofthetab
or
Me.tabcontrolname.TabPages(x).Select() where x is the index of the tab you want selected
Dean
|
|
|
|
|
Go into the properties, under behaviors and you will find TabIndex, this gives you the order in which the buttons or anything on the screen that you can inter act with, the order in which the item is given focuse, if you want to move from one imput to the next, hope this helps. ![Big Grin | :-D](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_biggrin.gif)
|
|
|
|
|
hi all
good morning,
can any one please tell me how can i drag a textbox from one cell in a tablelayoutpanel and drop it to another cell of the same tablelayoutpanel.
this is very urgent
please see if any help can i get
thanks and regards to all
SP
|
|
|
|
|
void tblTemplate_DragDrop(object sender, DragEventArgs e)
{
try
{
if (tblTemplate.Controls.Count < tblTemplate.RowCount * tblTemplate.ColumnCount)
{
RasterImageViewer rViewer = (RasterImageViewer)e.Data.GetData("MyData");
Point loc = this.tblTemplate.PointToClient(new Point(e.X, e.Y));
int ColumnIndex = -1;
int RowIndex = -1;
int x = 0;
int y = 0;
while (ColumnIndex <= this.tblTemplate.ColumnCount)
{
if (loc.X < x)
{
break;
}
ColumnIndex++;
x += this.tblTemplate.GetColumnWidths()[ColumnIndex];
}
while (RowIndex <= this.tblTemplate.RowCount)
{
if (loc.Y < y)
{
break;
}
RowIndex++;
y += this.tblTemplate.GetRowHeights()[RowIndex];
}
this.tblTemplate.Controls.Add(rViewer, ColumnIndex, RowIndex);
tblTemplate.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.AddColumns;
tblTemplate.PerformLayout();
}
else
{
return;
}
}
catch (Exception ex)
{
}
}
void tblTemplate_DragEnter(object sender, DragEventArgs e)
{
e.Effect = e.Data.GetDataPresent("MyData") ? DragDropEffects.Move : DragDropEffects.None;
}
write this code in move event of control which u want move
try
{
if (e.Button == MouseButtons.Left)
{
tblTemplate.AllowDrop = true;
RasterImageViewer objRaster = (RasterImageViewer)sender;
DataObject data = new DataObject("MyData", objRaster);
objRaster.DoDragDrop(data, DragDropEffects.Move);
}
}
catch (Exception ex)
{
}
|
|
|
|
|
Just what I was looking for - thanks...
|
|
|
|
|
I tried code from
http://support.microsoft.com/default.aspx?scid=kb;en-us;312839#XSLTH4156121122120121120120
As we are using window2003 we need to use CDOSYS code from given URL.
Its working on our side.
But giving problem on client side.
Can any one help me this?????
http://support.microsoft.com/default.aspx?scid=kb;en-us;312839#XSLTH4156121122120121120120
|
|
|
|
|
run a port sniffer on the server and see if any of the ports used are blocked on the firewall, or rely on IP or layer 2 broadcasts.
it may be an SMTP relay issue as well. if your sec policy disables the right that might be it.
I would typically advise against sending email from SQL (at least SQL2000). we had issues with it at work.
hey...slang is the vernacular for the vernacular...wow
|
|
|
|
|
hello my self is a beginner and this is my first question on vb code, I Like to now how to generate a vb code to show a picture ; as forum signature if img code is off and also html and smilies off. Is there a Way to show a picture in vb code? Thank you for any help. Greez Roger
-- modified at 0:42 Wednesday 5th April, 2006
|
|
|
|
|
line42 wrote: as forum signature if img code is off and also html and smilies off.
If you're hoping to show a picture in a forum, how do you expect your code to be run ?
In general, a picturebox lets you easily show a picture, Image.FromFile will let you load an image from the file system.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hello guys anyone could help me on how to set column in MSHFlexGrid in VB.Net..... hope you can give a sample code.....
thanks! ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
There is no .Net component called MSFlexGrid, It is a COM component.
Right Click MSFlexGrid control
Select properties
Select General tab
Now you can create columns and rows
Regards,
Chatura Dilan
If at first you don't succeed, try; try again, so that you know
what not to do the next time. The answer is out there.
|
|
|
|
|
thank you! i tried that already what i mean is how can i set the column width of MSHFlexGrid? i have this code "MSHF.set_ColWidth(1, 1, 50)" in run time but the result is the column did not adjust i want it to be widen....sorry for the confusion i've made in my previous posted message i forgot to type "width" hehehe my question is how to set column width..... thank for your support! ![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
you have used three arguments, wilde that's the error. You can use only two arguments according to this format
AxMSFlexGrid1.set_ColWidth(coloumn Number,width)
example
AxMSFlexGrid1.set_ColWidth(1,3000)
Regards,
Chatura Dilan
If at first you don't succeed, try; try again, so that you know
what not to do the next time. The answer is out there.
|
|
|
|
|
thanks chatura! i tried this format but it still didnt work......
AxMSFlexGrid1.set_ColWidth(coloumn Number,width)
example
AxMSFlexGrid1.set_ColWidth(1,3000)
but i tried this one it works ....
AxMSFlexGrid1.set_ColWidth(1, ,3000)
![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
I am new to the vb.net thing and am trying to self teach myself so any help is appreciated.
I need to be able to make sure that a textbox entry is only numbers and that I can backspace it to remove a bad entry.
I think its probably something like a bunch of ASCII characters to reference and valadate the entry but I am not sure.
Sub Text_KeyPress(KeyAscii As Integer)
If uiEnterInterNumTextBox.Text = KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0
and uiEnterInterNumTextBox.Text = KeyAscii
End Sub
|
|
|
|
|
heres how I would do it. remember, in vb, try not to do it the hard way. most of the time you'll find an easy one.
BTW somthing seems wrong with your keypress event handler, I'm used to
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
now if your working in vb 6 or VBA this code may not work.
by the way if this is homework, at least paraphrase... geta little edu for your money.
Sub Text_KeyPress(KeyAscii As Integer)
If isAllNumbers(uiEnterInterNumTextBox.Text)Then
KeyAscii = 0
uiEnterInterNumTextBox.Text = KeyAscii
End If
End Sub
Private Function isAllNumbers(ByVal teststring As String) As Boolean
Dim isgood As Boolean = True
For Each c As Char In teststring
If Not Char.IsDigit(c) and not(c = ".") and not( c = ",") Then
isgood = False
Exit For
End If
Next
Return isgood
End Function
hey...slang is the vernacular for the vernacular...wow
|
|
|
|
|
Or
You can use a MaskedTestbox to do it
Or
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress<br />
If (AscW(e.KeyChar) < 48 Or AscW(e.KeyChar) > 57) Then<br />
e.KeyChar = Nothing<br />
End If<br />
End Sub
Regards,
Chatura Dilan
If at first you don't succeed, try; try again, so that you know
what not to do the next time. The answer is out there.
-- modified at 23:25 Tuesday 4th April, 2006
'sorry.. when you use e.KeyChar = Chr(Keys.Back), other keys always do backspace's job. I corrected it. It must be e.KeyChar = Nothing
|
|
|
|
|
see...easy answers
hey...slang is the vernacular for the vernacular...wow
|
|
|
|
|
This is the code:
Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
TextBox1 = Nothing
TextBox2 = Nothing
TextBox3 = Nothing
TextBox5 = Nothing
TextBox6 = Nothing
DateOfbirth = Now
TextBox7 = Nothing
TextBox8 = Nothing
TextBox9 = Nothing
TextBox10 = Nothing
TextBox11 = Nothing
Department = "Administration"
personal = New Personal
when i click the rest button nothing happens. when i use Form.reset() it doesnt change anything either. Can someone please help?
-- modified at 20:16 Tuesday 4th April, 2006
|
|
|
|
|
That is because you are not doing anything at all to the controls. The TextBox1 variable is not a textbox, it's only a reference to the textbox. When you set the variable to Nothing, you are only throwing away your reference to the control. That doesnt affect the control the least bit, it couldn't care less whether you have a reference to it or not.
If you want to change the contents of the control, set the Text property of the control.
---
b { font-weight: normal; }
|
|
|
|
|
Thankyou heaps i have got it to work now. your a great help.
just one more thing, im trying to get my application to send an email to the user if they forget their password, the code is:
If My.User Is Authenticated Then
txtUser.Text = My.User.Name
If userExists(My.User.Name) Then
txtPassword.Focus()
Else : NewUser = True
MessageBox.Show("You are new to the system, please select request account and enter your details", "User Information")
End If
Else if
MessageBox.Show("Sorry you are not authenticated to use this program" & vbNewLine & "If you are a staff member please select help or contact us")
End If
im not sure how to declair Authenticated,userExists and new user. With userExists i need to get it to check the database where all the users are stored yes? but im not to sure how to do this
![OMG | :OMG:](https://www.codeproject.com/script/Forums/Images/smiley_OMG.gif)
|
|
|
|
|
on the topic of email, this is how I do it for VB forms. it also works when exposed through a web service.
Imports system.net.Mail
public class mailer
Private email As MailMessage
Private webmailer As System.Net.Mail.SmtpClient
Private Sub sendMail()
email = New MailMessage("Sender Email", "Reciepient Email", "Subject Text", _
"Body Text")
webmailer = New System.Net.Mail.SmtpClient("SMTP Server Name as String", _
"SMTP service port: usually 25")
With email
.Attachments(0) = New Attachment("c:\SomeFile.txt")
.Attachments(1) = New Attachment("c:\SomeOtherFile.txt")
End With
webmailer.Send(email)
End Sub
end class
server admin has a big impact on whether this will work. if it fails it may not be the code, but the smtp server configuration.
good luck
hey...slang is the vernacular for the vernacular...wow
-- modified at 21:35 Tuesday 4th April, 2006
|
|
|
|
|
Make sure you are setting the .Text property to "" or String.Empty. You are attemting to set the Controls (TextBox1, TextBox2, etc.) to Nothing.
Example
TextBox1.Text = String.Empty
This also works
TextBox1.Clear
Hope this helps
"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
( President Ronald Reagan)
|
|
|
|