|
I don't think there's any reason for If TextBox1.Text = a And TextBox1.Text = b Then . Of course they're going to be equal because that's what the query was to start with. (I assume you meant to say And TextBox2.Text = b instead of TextBox1 twice.)
If the username and password are shown in the textboxes when the form loads, clear the textboxes in Form_Load() .
|
|
|
|
|
Nothing happen:
Try
sUNAME = Trim(TextBox1.Text)
sPass = Trim(TextBox2.Text)
conn.Open()
cmd = New SqlCommand("select * from usrs where uname = @user and upwd = @pwd", conn)
cmd.Parameters.AddWithValue("@user", Trim(TextBox1.Text))
cmd.Parameters.AddWithValue("@pwd", Trim(TextBox2.Text))
dr = cmd.ExecuteReader
If dr.HasRows = 0 Then
MsgBox("Invalid User or Password, Try Again", vbCritical, "Login Error")
TextBox2.Clear()
TextBox1.SelectionStart = 0
TextBox1.SelectionLength = Len(TextBox1.Text)
TextBox1.Focus()
Exit Sub
Else
While dr.Read()
a = dr.Item("uname")
b = dr.Item("upwd")
If sUNAME = a And sPass = b Then
sid = dr.Item("uid")
ProgressBar1.Visible = True
valid = True
End If
End While
End If
dr.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
conn.Close()
cmd = Nothing
End Try
form closing event:
sUNAME = String.Empty
sPass = String.Empty
|
|
|
|
|
Hi Frnds..
I need to convet byte array into string and send the text to SMTP Server for sending mails..
Thnks in advance...
Regards Pushpa...
|
|
|
|
|
Dim s As String = System.Text.Encoding.Default.GetString(bytearray)
|
|
|
|
|
In my project I have 3 datatables with different data inside. I have datatables like:
Customers:
Customer number | Name | ID | 123450 | Customer A | 169 | 987650 | Customer B | 753 |
orders in last week:
and orders in sekond week in past:
Now I want to combine these tables data to table like next:
Customer number | Name | ID | 1 week
| 2 week
| 123450 | Customer A
| 169 | 7 | 9 | 987650 | Customer B
| 753 | 3 | 2 |
I know this can be done with datarelation or with SQL inner join but idont have any datasource in my project becose I parse these datas from csv-file to in-memory datatables and dataset.
So how can i do this 4th table in my project?
Thanks in advance
TEH
|
|
|
|
|
_teh_ wrote: I parse these datas from csv-file to in-memory datatables
What makes you think you cannot create a datarelation for a dataset (a dataset is always an "in memory" construct).
You will need to move the 3 tables to the 1 dataset and then create the realtions but this is easy using dataset.tables.add
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
So this can be done with datarelations.
I have not use datarelations before so could you please tell me how should I create the relation to get same result than with this SQL-code?
SELECT a.customerID, a.Name, a.shop_id, ISNULL(sa.PCS1, 0) AS PCS1, ISNULL(sb.PCS2, 0) AS PCS2
FROM customers AS a
LEFT JOIN Shop1 AS sa ON (a.shop = sa.shop)
LEFT JOIN Shop2 AS sb ON (a.shop = sb.shop)
|
|
|
|
|
Data relations are not the same as joins. Only the inner join is valid in a data relation. RTFM type in datarelation hit F1 for more details.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Dim Table1 As DataTable
Table1 = New DataTable("Customers")
What would be the other way to write this statement??
Please Suggest
Thank You
Nitin
Nitin Jenwal
|
|
|
|
|
Dim table1 As New DataTable("customer")
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
i have a datagridview with a button column ,
i want to get the information in same row with abutton i clicked
help me plz
|
|
|
|
|
hi..,
see this code .., this may help u
Private Sub DataGridView1_CellMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles dgOnlineTrains.CellMouseClick
Select Case e.ColumnIndex
Case 0
MsgBox("1 Clicked")
Case 1
MsgBox("2 clicked")
Case 2
MsgBox("3 clicked")
End Select
End Sub
Thanks & Regards
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Hi,
i have developed one activeX component which will be used in web page.
I want control of that web page so that i can give some values to java script which is in that web page.
my question is : how can i access java script from activeX component which is developed in VB6.
thanks
ravi
|
|
|
|
|
am developing an application using vb.net, i created a user control which used in the another application.
am passing parameters to the user control using public properties from files.
i specified a folder , when a new file is created in the folder. in the timer control code am adding the new user control dynamically if the usercontrol is not exists, if it's already exists am updation the values.
problem is when am updation the one usercontrol. the total usercontrols values are changing (as like reference), but am creating new instants every time.
Here is the code :
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Enabled = False
Try
Dim Files As String() = Directory.GetFiles(Application.StartupPath & "\data")
Dim Filename As String
For Each Filename In Files
Dim line As String
Using sr As StreamReader = New StreamReader(Filename)
line = sr.ReadToEnd
End Using
Dim cntrllop As Integer, cntlflg As Boolean = False
For cntrllop = 1 To mycontrolcoll.Count
If (UCase(mycontrolcoll.Item(cntrllop).Name) = UCase(Split(Filename, "\")(Split(Filename, "\").Length - 1))) Then
parse_data(mycontrolcoll.Item(cntrllop), line, Filename)
cntlflg = True
End If
Next
If cntlflg = False Then
SyncLock mycontrolcoll
mycontrolcoll.Add(New UserControl1, UCase(Split(Filename, "\")(Split(Filename, "\").Length - 1)), Nothing, Nothing)
mycontrolcoll.Item(mycontrolcoll.Count).name = UCase(Split(Filename, "\")(Split(Filename, "\").Length - 1))
FlowLayoutPanel1.Controls.Add(mycontrolcoll.Item(mycontrolcoll.Count))
parse_data(mycontrolcoll.Item(mycontrolcoll.Count), line, Filename)
End SyncLock
End If
'My.Computer.FileSystem.DeleteFile(Filename)
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
Timer1.Enabled = True
End Sub
Private Sub parse_data(ByRef MYcontrol As CAMR_Control.UserControl1, ByVal data As String, ByVal filename As String)
MYcontrol.Name = Mid(Split(data, ",")(0), 2)
MYcontrol.Pow_ctrlstart = True
MYcontrol.Pow_v1 = Split(data, ",")(1)
MYcontrol.Pow_v2 = Split(data, ",")(2)
MYcontrol.Pow_v3 = Split(data, ",")(3)
MYcontrol.Pow_i1 = Split(data, ",")(4)
MYcontrol.Pow_i2 = Split(data, ",")(5)
MYcontrol.Pow_i3 = Split(data, ",")(6)
MYcontrol.Pow_p1 = Split(data, ",")(7)
MYcontrol.Pow_p2 = Split(data, ",")(8)
MYcontrol.Pow_p3 = Split(data, ",")(9)
Dim fileData As FileInfo = My.Computer.FileSystem.GetFileInfo(filename)
MYcontrol.Pow_lastread = Format(fileData.LastWriteTime, "dd-MMM-yyyy HH:mm:ss")
'MYcontrol.Pow_nodenumber = Mid(Split(data, ",")(0), 2) & " ,"
MYcontrol.Pow_nodenumber = MYcontrol.Name & " ,"
MYcontrol.Refresh()
FlowLayoutPanel1.Refresh()
End Sub
Please help me ..,
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
|
hi
i am useing crystal 7 file in vb.net
thru crystal report cantrol i geting hresult exection on logonserver
dim axcr as crystalreportcntrol
With axcr
.ReportFileName = "D:\D.NET\Marfatiya\report\billoutstanding.rpt"
i = .LogOnServer("p2ssql.dll", server01, REP00, userxx, passxx)
.set_ParameterFields(0, "P1 ;" + conmxx + ";TRUE")
.Action = 0
.Destination = Crystal.DestinationConstants.crptToWindow
End With
|
|
|
|
|
Standard Question #1: What's the error message, exactly??
|
|
|
|
|
Hi,
Thank's
i don't know actule error but i getting this error Exception from HRESULT: 0x800A5038
i am getting
|
|
|
|
|
From what little information I can find on the result, it looks like either the .DLL isn't where it should be or the server name can't be resolved. I also found a possible reference to the username/password being bad.
|
|
|
|
|
Hi,
In my project, Code is written for an event in the application level to display a dialog box after a fixed interval of time. I don't have that code I have only the reference for that code.
So when that event is getting fired i want to handle that event not to display that dialog box. How can i do that.
Thanks & Regards
Mishra
|
|
|
|
|
You can run these code with a separate Thread.
|
|
|
|
|
If the event isn't exposed to you but is only handled internally in the code, you can't handle the event. You'll never see it.
Otherwise, you'll need the signature of the event handler that the code is expecting you to implement. After that, it's a simple matter of writing the event handler and wiring it to the event using the AddHandler statement.
|
|
|
|
|
I'm trying to implement IShellExtInit:Initialize using VB 2005 and have been able to successfully handle the IDataObject, but I'm at a loss as to how to handle the LPCITEMIDLIST. What I really need is a simple function (or a walkthrough) to convert a LPCITEMIDLIST to a path.
While there are some great resources out there if you know C++ (I know very little), I have yet to find this answer for VB programmers. Any help is appreciated!
Thanks,
-Tom
modified on Tuesday, September 9, 2008 4:26 PM
|
|
|
|
|
Tom,
You may have seen this page, Visual Basic Shell Programming[^], but about midway down it says:
Consider the first parameter of the Initialize method, which is an LPCITEMIDLIST. The documentation for the interface states that this is an address of an ITEMIDLIST.
Did you try casting it as an IntPtr ? A further down, there is ByVal pidlFolder As VBShellLib.LPCITEMIDLIST , which sounds like what you want. I believe this[^]is the source for that library. I'd figure a compiled version is out there somewhere, too.
Maybe not helpful, but maybe it will be.
|
|
|
|
|
Yes, I've got all this information and, in fact, own the book! However, beyond getting the pointer, I can find nothing that helps me understand what to do with the ITEMIDLIST - that's the heart of this question.
The JZ wrote: You may have seen this page, Visual Basic Shell Programming[^], but about midway down it says:
Consider the first parameter of the Initialize method, which is an LPCITEMIDLIST. The documentation for the interface states that this is an address of an ITEMIDLIST.
Did you try casting it as an IntPtr? A further down, there is ByVal pidlFolder As VBShellLib.LPCITEMIDLIST, which sounds like what you want. I believe this[^]is the source for that library. I'd figure a compiled version is out there somewhere, too.
Thanks,
-Tom
|
|
|
|
|