|
sorry it is a windows form datagrid. retrieving data from sql server. i placed combobox in datagrid. the data which is backend from one of the field is displaying in combobox, but when i am adding new row in grid, it is not placing the value in grid from combobox. and even i want to add new value in the combobox. It is not giving any error.
Thank you for trying,
bye
|
|
|
|
|
there's error, "Wrong protocol or connection state for the requested transaction or request - Error number: 40006" --the failed line is Winsock1.SendData (Txtinput.Text)-- can u give me a hint Thank you
|
|
|
|
|
Without more information, like what version of VB your using, or even the code that is setting up and opening the connection, it's impossible to tell you, with any certainty, what's wrong.
But, on the assumption your using VB6, I'll point you at PRB: SendData Method Generates Error 40006[^] on MSDN. It's probably what your doing wrong.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi all,
trying to understand classes but come up with this problem
'how can i access this class, without putting a timer of the form, i.e the control has its own timer
Private Class clock
Inherits Timer
PublicFunction systemtime()
If Me.Enabled = FalseThen ' enable timer if not already
Me.Interval = 500 ' 1/2 secs
Me.Enabled = True
EndIf
systemtime = Now.Second 'get system second, cant be anthing just example.
EndFunction
PrivateSub Test_Tick(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMyBase.Tick ' on tick run the function
systemtime()
End Sub
End Class
Friend Class Count
Dim test As New clock
Dim timer1 As New clock
Public Function displaytime() As String
displaytime = timer1.systemtime
End Function
End Class
PrivateSub Form1_Load(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMyBase.Load
Dim test As New Count
'********* problem here************
'because this is only run once
Label1.Text = test.displaytime() 'this only happens once
End Sub
EndClass
'is there a way of running this class and passing the data to the label withing the timer class?
Happy Xmas to all!
From
Shortcircuit Software!
|
|
|
|
|
You need to have an event that is fired by your class when the time changes or whatever it is you want to display, the form can then handle this and update the label:
Public Event UpdateTime As EventHandler
So to fire the event:
Protected Overrides Sub OnTick(e As EventArgs)
Me.SystemTime
'Some sort of test to see if you want to fire the event
If IsChristmas Then
RaiseEvent UpdateTime(me, EventArgs.Empty)
End If
End Sub Then in on the form:
Private Sub Clock_UpdateTime(e as EventArgs, sender as Object) Handles Clock.UpdateTime
Label1.Text = Clock.DisplayTime
End Sub
Hope this helps
Tom
|
|
|
|
|
Thanks for your help, i needed further info but you lead me in the right direction
i came up with this.... (this works!).....
Private WithEvents timer As Clock = New Clock
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = timer.systemtime
End Sub
Private Sub timer_UpdateTime(ByVal sender As Object, ByVal e As System.EventArgs) Handles timer.Tick
Label1.Text = timer.systemtime
End Sub
Public Class Clock
Inherits timer
Public Event UpdateTime As EventHandler
Private Sub Test_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Tick
systemtime()
End Sub
Public Function systemtime()
If Me.Enabled = False Then
Me.Interval = 125
Me.Enabled = True
End If
systemtime = Now.Second
RaiseEvent UpdateTime(Me, EventArgs.Empty)
End Function
End Class
Thank you and have a Merry Xmas
Andy
|
|
|
|
|
i need to control 2 cmdbuttons between 2 Lan-PC . Can u give me some advices plz such as Tool , Component or Code . Thx
|
|
|
|
|
i need to control 2 cmdbuttons between 2 Lan-PC . Can u give me some advices plz such as Tool , Component or Code . Thx
|
|
|
|
|
You going to have to be alot more descriptive than that. What do you mean by "control"? Are you saying that you want one PC to click on button on another PC?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i mean ,if the cmdbutton on my computer clicked ,it would affect to the cmdbutton on your computer , which component should i use ? can u give me some advise .
|
|
|
|
|
There isn't any one component. It's not a simple matter of sending a little message to the other machine. You're talking about writing your own little version of PCAnywhere. You'll need to write a server piece, which runs on the computer you want to control, and a client that will run on your machine. Basically, begin researching VNC clients. Search the comments in the VB and C# Forums and you'll come up with lots of mentions and links to some good VNC libraries that you can use.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am building a simple FTP client with download feature. How can i authenticate myself after providing parameters on the FTP server. This the Log In code but the problem is that it is not authenticating me.
Public Function LogIn() As Boolean
m_objClientSocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Dim Ep As IPEndPoint = New IPEndPoint(Dns.Resolve(m_strRemoteHost).AddressList(0), m_intRemotePort)
Try
m_objClientSocket.Connect(Ep)
Catch ex As Exception
MessageString = m_strReply
Throw New IOException("Cannot connect to the Remote Server")
End Try
ReadReply()
If (m_intRetValue <> 220) Then
CloseConnection()
MessageString = m_strReply
Throw New IOException(m_strReply.Substring(4))
End If
SendCommand("USER " & m_strRemoteUser)
If (Not (m_intRetValue = 331 Or m_intRetValue = 202)) Then
CleanUp()
MessageString = m_strReply
Throw New IOException(m_strReply.Substring(4))
End If
If (m_intRetValue <> 230) Then
SendCommand("PASS " & m_strRemoteUser)
If (Not (m_intRetValue = 230 Or m_intRetValue = 202)) Then
CleanUp()
MessageString = m_strReply
Throw New IOException(m_strReply.Substring(4))
End If
End If
m_blnLoggedIn = True
ChangeDirectory(m_strRemotePath)
Return m_blnLoggedIn
End Function
|
|
|
|
|
I am having trouble writing data to my xml file. I already have a StreamReader that reads the data, but when I use StreamWriter to write the data back out to the file, it writes data, but it writes blank data. It clears my file so the next time I try to run my program an error message says it can't find the origional table that was in my file before, of course thats because it isn't there now. any suggestions on what I may be doing wrong? I am writing from a form with a datagrid.
HAPPY HOLIDAYS
|
|
|
|
|
You are probably not closing the file properly after you have written to it. Have a look at the DataSet.ReadXml and DataSet.WriteXml on MSDN, both have examples of how to code it properly:
DataSet.ReadXml - MSDN[^]
DataSet.WriteXml - MSDN[^]
Hope this helps
Tom
|
|
|
|
|
How to know the functions decleared in unknown dll file of some other software
|
|
|
|
|
You might want to look into PE Explorer, here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I would like to ask how can i retrieve data from the selected row of the Datagrid.
Thank you.
|
|
|
|
|
|
DataGrid1.SelectedItem.Cells(0).Text
(First Column Value From Selected Row)
'Cause I'm living on things that excite me, be it pastries or lobsters or love... I'm just trying to get by, being quiet and shy, in a world full of push and shove...
Jimmy Buffett - The Wino and I know
|
|
|
|
|
I have a vb6 app with no forms that is run in dos window. How do I output to the window if I want to send a message. No Msgbox (I don't want things popping up)
so I want something like this
c:\ingroup
c:\You must provide a parameter with ingroupc
c:\Example ingroup /i
Something like that if possible?
thanks
|
|
|
|
|
VB6 couldn't target a console app. You have to call into the Win32 API to create a console and output to it. You might want to try here[^] for a couple of console classes for VB6.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks I will take a look at the samples.
Do you happen to know how I pass a error level code back after terminating the code? I want to check in the batch file for errors in the code.
Thanks
I found one thing but I put it in the code and tested it and it booted me out of VB and I lost it
Forgot to save.
|
|
|
|
|
Also wanted to ask if there is an easier way to do this in vb.net?
|
|
|
|
|
All of this is trivial in VB.NET since it, and any other language targeting the .NET Framework, can target a console app. Support for I/O redirection and exit codes are included. Even better support is included in the .NET Framework 2.0 and Visual Studio/Basic .NET 2005.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
That would be done with the ExitProcess Win32 API function. VB6 can't do it natively.
Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
.
.
ExitProcess(returnCode)
This will have the effect of terminating your app immediately, so you better have everything cleaned up before you call this.
Also, when you launch a VB6 app from a batch file, it won't wait for it to complete. Unless, of course, you tell it to using:
START /W vbApp.exe
...ERRORLEVEL statements go here
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|