|
Hi Folks
Does anyone know of any good online resources for picking up VB.NET?
I have a few years experiences in both C# and VB6. So i was hoping there might be a quick start guide or something out there?
Thanks
Rich
|
|
|
|
|
|
I'm trying to run a method ina remoting client application
this button event calls this message
Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
Dim WindowClient2 As ClientProcess2
WindowClient2.SendMessage2()
End Sub
SendMessage2 HAS THIS SET UP:
Public Sub SendMessage(ByVal recipientAlias As String, _
ByVal AlertId As String, _
ByVal message As String, _
ByVal isReturning As String, _
ByVal Urgency As String, _
ByVal TimeStamp As String, _
ByVal TimetoExecute As String, _
ByVal SysOrigin As String, _
ByVal IsActive As String)
Try
Server.SendMessage(Me.Alias, recipientAlias, AlertId, message, isReturning, Urgency, TimeStamp, TimetoExecute, SysOrigin, IsActive)
Catch ex As Exception
logit(ex.Message & "-" & ex.StackTrace)
End Try
End Sub
End Class
this method is inside of a class that starts like
Imports System.IO
Imports System.Runtime.Remoting
Imports AlertInterface
Public Class ClientProcess
Inherits MarshalByRefObject
Implements IAlertClient
TO FINISH, SENDMESSAGE IS LIKE THIS ON THE INTERFACE
Sub SendMessage(ByVal senderAlias As String, _
ByVal recipientAlias As String, _
ByVal AlertId As String, _
ByVal message As String, _
ByVal isReturning As String, _
ByVal Urgency As String, _
ByVal TimeStamp As String, _
ByVal TimetoExecute As String, _
ByVal SysOrigin As String, _
ByVal IsActive As String)
ANY CLUE OF WHAT i AM DOING WRONG?
CHERRS!
|
|
|
|
|
blucas2005 wrote: STRANGE Object reference not set to an instance of an object
Not strange at all.
blucas2005 wrote: Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
Dim WindowClient2 As ClientProcess2
WindowClient2.SendMessage2()
End Sub
What is WindowClient2 set to? It is set to Nothing . So when you call SendMessage2() you get an exception.
You need to set WindowClient2 to a suitable object.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Hi, I'm trying to create the following scenarion
You have 2 winforms A and B
A has a Sub that will pop a msgbox("oi")
and a button that pops form b
forms b has a button that raise a event on A and run the sub with the msgbox
i tried the code bellow, it worked in a console version, but is not working when in a winform
could you help me?
code bellow:
''''FIRST CLASS
Public Class CClock
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
mobjTimer = New CTimer
AddHandler mobjTimer.evtMinute, AddressOf MinuteEvent
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
Private Sub MinuteEvent(ByVal xintTime As String)
TextBox1.Text = "crap"
MsgBox("Minute's Event")
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
End Region
Private WithEvents mobjTimer As CTimer
Private Sub CClock_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim xx As New CTimer
xx.Show()
End Sub
End Class
''''SECOND CLASS
Public Class CTimer
Inherits System.Windows.Forms.Form
''delegate
Delegate Sub SecondDel(ByVal xintTime As String)
'''delegate instance
Private evtSecond As SecondDel
''delegate
'''EVENTS
Public Event evtMinute As SecondDel
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
End Region
Private Sub CTimer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RaiseEvent evtMinute("lngSeconds")
End Sub
End Class
|
|
|
|
|
It's not working because you are creating 2 separate instances of the CTimer form and only handle the event of the first.
You see, you've created a CTimer form instance and stored it in a member variable in the constructor. You hooked up an event handler to it there too. BUT... you never did a Form.Show() of this object in your code. The event handler that you've setup was only for that particular object instance which was never used.
Public Sub New()
MyBase.New()
mobjTimer = New CTimer
AddHandler mobjTimer.evtMinute, AddressOf MinuteEvent
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
When you displayed the CTimer form, you created a new form instance here. It is firing an event, but you never set up a handler for this particular object instance. So this is where your problem lies.
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim xx As New CTimer
xx.Show()
End Sub
Here str my recommendations.
- Remove the AddHandler from CClock's constructor. The WithEvent assigned to the member will automatically hook up event handlers for you. (Plus you're missing a RemoveHandler anyways.)
- Append "Handles mobjTimer.evtMinute" (without double quotes) to your MinuteEvent method. This makes it work with the WithEvents keyword.
- Do not create a new CTimer object in CClock's Button1 method! Instead, do a mobjTimer.Show().
-- modified at 15:46 Sunday 12th February, 2006
|
|
|
|
|
Hey, can anyone teach me how to create a custom progressbar control which can have multiple colors? For e.g. values 0-50 = green, 50-80=yellow and 80-100 = red.
Thank you.
|
|
|
|
|
|
Thanks, I have already gotten those examples.
|
|
|
|
|
It's next to impossible to "show" anyone how to build an entire project in a forum. There's just so much material to cover, it'd take over an article to explain it all. You're best bet is to analyze the code in those projects, picking out the design details and experimenting with them to give you a better idea of what's going on.
A control is just a container that stores and manipulates a very specific piece of data and supplies a UI for input (optional!) and custom drawing code to display that data. Keep those three things in mind an you should have no problem picking out the various pieces of those controls.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yea thaks for your guides, i am already analyzing several samples and integrating them into one single project, hopefully i can publish one control in future =) thanks!
|
|
|
|
|
This has been overdone, yet not so... i am looking for a simple way to send emails using vb. I have tried the code to no avail. I have SP6 so i redid the .dll and reregistered it. It would still not connect, stating that ther server was not respoding to the inqury. I've tried countless ways, the most i got was with yahoo mail, that got up to 6% and errored. The general consensis is that these things are tricky if possible to get to work. anyone who succeded would be greatly appreciated. I will use any webmail. hotmail, gmail, yahoo.com or yahoo.ca if anyone knows the proper way to get these to respond.. the only other option is that my outlook to be configured to hotmail, and then set vb to use outlook with MAPI...
"Love, Life and Option Explicit"
|
|
|
|
|
Outlook Express is just a wrapper for the MAPI Api, which your VB6 code is also using. Any settings done in Outlook Express will also effect your code.
But, you have to specify the SMTP and POP3 servers that Yahoo, or any other mail server, is using. You might even have to supply some kind of login to send anything using those servers. I have no idea myself, since I never use them...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The code i linked to uses STMP and POP3 servers, and lets you specify login-in informatio, yet it will not show thre respones.. it also inclides a mx query to find ther servers, yet it will not return any response from them.
"Love, Life and Option Explicit"
|
|
|
|
|
ThePmanLives wrote: The code i linked to uses ...
What code? I didn't see a link to any code...
ThePmanLives wrote: yet it will not show thre respones..
What is "it"?
ThePmanLives wrote: it also inclides a mx query to find ther servers
MX query??? Not in an SMTP session. Is this a DNS request you're doing?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hmmm.. it appears the link did not show... http://www.freevbcode.com/ShowCode.Asp?ID=109
it is a .dll that should let you set it up that way. the mxquery, i assumed would locate mail servers, as in my research i found people trying to ocnnect to the mx1.hotmail.com, and having it succeed. "IT" is the program from the a-for-mentioned link. it keeps telling me the servier will not respod to queries.
"Love, Life and Option Explicit"
|
|
|
|
|
OK. An MX ookup is a DNS query that returns registered mail servers, so long as the servers are registered in the DNS that your querying. You can test this by launching a command prompt and typing:
C:\>NSLOOKUP
*** Can't find server name for address 192.168.0.1: Non-existent domain
*** Default servers are not available
Default Server: UnKnown
Address: 192.168.0.1
> server mx1.hotmail.com
Default Server: mx1.hotmail.com
Addresses: 65.54.244.8, 64.4.50.50, 65.54.245.8, 65.54.244.136
> set type=MX
> hotmail.com
Server: mx1.hotmail.com
Addresses: 65.54.244.8, 64.4.50.50, 65.54.245.8, 65.54.244.136
Non-authoritative answer:
hotmail.com MX preference = 5, mail exchanger = mx4.hotmail.com
hotmail.com MX preference = 5, mail exchanger = mx1.hotmail.com
hotmail.com MX preference = 5, mail exchanger = mx2.hotmail.com
hotmail.com MX preference = 5, mail exchanger = mx3.hotmail.com
mx1.hotmail.com internet address = 64.4.50.50
mx1.hotmail.com internet address = 65.54.245.8
mx1.hotmail.com internet address = 65.54.244.136
mx1.hotmail.com internet address = 65.54.244.8
mx2.hotmail.com internet address = 65.54.245.40
mx2.hotmail.com internet address = 65.54.244.168
mx2.hotmail.com internet address = 65.54.244.40
mx2.hotmail.com internet address = 65.54.190.50
mx3.hotmail.com internet address = 65.54.244.200
mx3.hotmail.com internet address = 64.4.50.179
mx3.hotmail.com internet address = 65.54.244.72
mx3.hotmail.com internet address = 65.54.245.72
mx4.hotmail.com internet address = 65.54.190.179
mx4.hotmail.com internet address = 65.54.244.104
mx4.hotmail.com internet address = 65.54.244.232
mx4.hotmail.com internet address = 65.54.245.104
>
This is a normal DNS query that the component is making. It returns the entire list of regeistered mail server at HotMail. The component would then try to use any of these mail servers to send your mail.
The problem is that this is a custom written component that I/We've never used or even seen. I can't tell you what it needs to work and I can't tell you why it's saying that there are no servers. I just don't know how the component works or why it fails. The best source of information is the site or person who wrote it!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Please send me the simplest procedure to connect SQL with VB.NET.
Umair Qayyum
|
|
|
|
|
This is the simplest procedure to connection SQL with VB.NET:
Dim myConnection As SqlConnection = New SqlConnection(myConnectionString)
myConnection.Open()
This assumes that you have the connection string in a variable called myConnectionString.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
-- modified at 8:04 Sunday 12th February, 2006
|
|
|
|
|
Hello
i am trying to find a way that i can change the Printer.CurrentY from 1300 to 1550 for the next record and increse it by 250 for each record in the database. i have tried for next and do loop if anyone has any idea how to do this i would be most greatful.
Printer.CurrentX = 7500
Printer.CurrentY = 1300
Printer.Print RowBuf(5, i)
|
|
|
|
|
You haven't posted any For/Next loop code, so it's impossible to tell you what went wrong. It's been over 5 years since I touched VB6, so let's see:
Dim i As Long
For i = 0 to 10
' More printer code...
Printer.Y = Printer.Y + (i * 250)
' Whatever else you're printing...
Next i
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks dave here is the code that i am trying to use. i added you bit but it prints like this
aaaa
bbbb
cccc
not like aaaa bbbb cccc
i hope this helps
Do Until rs.EOF
RowBuf = rs.GetRows(5000)
RowsReturned = UBound(RowBuf, 2) + 1
For i = 0 To RowsReturned - 1
For s = 0 To 10
Printer.CurrentX = 500
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print RowBuf(2, i)
Printer.CurrentX = 2000
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print RowBuf(3, i)
Printer.CurrentX = 2750
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print RowBuf(4, i)
Printer.CurrentX = 6000
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print RowBuf(6, i)
Printer.CurrentX = 7500
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print RowBuf(5, i)
If adoMeds.Recordset.Fields("finish") <> "None" Then
Printer.CurrentX = 9000
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print RowBuf(7, i)
Else
Printer.CurrentX = 9000
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print " "
End If
Next s
Next i
Loop
|
|
|
|
|
sorry i did try Printer.CurrentY = Printer.CurrentY + (s * 250)
with the same result as with the +
bolson50 wrote: thanks dave here is the code that i am trying to use. i added you bit but it prints like this
aaaa
bbbb
cccc
not like aaaa bbbb cccc
i hope this helps
Do Until rs.EOF
RowBuf = rs.GetRows(5000)
RowsReturned = UBound(RowBuf, 2) + 1
For i = 0 To RowsReturned - 1
For s = 0 To 10
Printer.CurrentX = 500
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print RowBuf(2, i)
Printer.CurrentX = 2000
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print RowBuf(3, i)
Printer.CurrentX = 2750
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print RowBuf(4, i)
Printer.CurrentX = 6000
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print RowBuf(6, i)
Printer.CurrentX = 7500
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print RowBuf(5, i)
If adoMeds.Recordset.Fields("finish") <> "None" Then
Printer.CurrentX = 9000
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print RowBuf(7, i)
Else
Printer.CurrentX = 9000
Printer.CurrentY = Printer.CurrentY + (s + 250)
Printer.Print " "
End If
Next s
Next i
Loop
|
|
|
|
|
thanks dave i did play with it some more and got it to work here is the code i used.
Dim s As Long
Dim sp As Long
For i = 0 To RowsReturned - 1
sp = Printer.CurrentY = 1300
s = Printer.CurrentY + (sp + 0)
Printer.CurrentX = 500
Printer.CurrentY = s
Printer.Print RowBuf(2, i)
Printer.CurrentX = 2000
Printer.CurrentY = s
Printer.Print RowBuf(3, i)
Printer.CurrentX = 2750
Printer.CurrentY = s
Printer.Print RowBuf(4, i)
Printer.CurrentX = 6000
Printer.CurrentY = s
Printer.Print RowBuf(6, i)
Printer.CurrentX = 7500
Printer.CurrentY = s
Printer.Print RowBuf(5, i)
If adoMeds.Recordset.Fields("finish") <> "None" Then
Printer.CurrentX = 9000
Printer.CurrentY = s
Printer.Print RowBuf(7, i)
Else
Printer.CurrentX = 9000
Printer.CurrentY = s
Printer.Print " "
End If
Next i
|
|
|
|
|
BC30108: 'FormsAuthenticationTicket' is a type and cannot be used as an expression.
objTicket = FormsAuthenticationTicket(2, textUsername.Text, DateTime.Now.AddMinutes(30), False, dtrRoles)
|
|
|
|
|