Jump to content
Xtreme .Net Talk

Andi03

Avatar/Signature
  • Posts

    43
  • Joined

  • Last visited

Andi03's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thanks! I will look in to it. I want to try it befor looking at others work. I will now been googleing parse formula and look up stacking in my old programming book.
  2. Hi. If I enter a function into a textbox, for example f(x) = 3x+1 where the 3x+1 is the part entered into the text box. How can I from that calculate the values for x = 2, x = 3 and so on so I can stor the values in array. Im making a application that will plot the function intp a graph so I need to calculate som of the values the function will return so I can plot it. If im not clear in my text respond and I'll try to explain more. Thanks for any help that will be given to me. //A
  3. Hi. Is there any easy way to keep track of the amount of downloaded/uploaded bytes? I just want to make a lite program thats runs in the background and keeping track on my dwnload/upload. Any tutorials or code snippets would be very helpfull. //Andi
  4. Ok...Here I go. I get no error messages and im connecting to ther right adress. I tried to connect to another remote adress and requested a webpage and that worked. Here is the code that I use to connect: Imports System.Net Imports System.Net.Sockets Imports System.IO Imports System.Text Imports System.Drawing Imports System.Drawing.Imaging Private ClientSocket As Socket Private ASCII As New System.Text.ASCIIEncoding Private DevMode As Boolean = True *** Skiped: Windowsorm Designer generated code *** Private Sub btnCoonnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCoonnect.Click Dim Addr As IPAddress = Dns.Resolve(txtIP.Text).AddressList(0) If Not Addr Is Nothing Then 'Create an ip endpoint Dim EP As New IPEndPoint(Addr, CInt(txtPort.Text)) ClientSocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) 'Connect ClientSocket.BeginConnect(EP, AddressOf ConnectCallback, Nothing) SendTimeRequest End If End Sub Private Sub SendTimeRequest() Try Dim bytes() As Byte = ASCII.GetBytes("GETTIME" & vbCrLf) Catch ex As Exception If DevMode Then MsgBox(ex.Message) End Try End Sub Private Sub ConnectCallback(ByVal ar As IAsyncResult) Try ClientSocket.EndConnect(ar) Dim dlg As New NoParamsDelegate(AddressOf ConnectedUI) Me.Invoke(dlg) 'Begin recieving data Dim bytes(8192) As Byte ClientSocket.BeginReceive(bytes, 0, bytes.Length, SocketFlags.None, AddressOf RecieveCallback, bytes) Catch ex As Exception If DevMode Then MsgBox(ex.Message) End Try End Sub Private Delegate Sub NoParamsDelegate() Private Sub ConnectedUI() Try Me.btnCoonnect.Enabled = False Me.txtIP.Enabled = False Me.txtPort.Enabled = False Catch ex As Exception If DevMode Then MsgBox(ex.Message) End Try End Sub Private Sub DisconnectedUI() Try Me.btnCoonnect.Enabled = True Me.txtIP.Enabled = True Me.txtPort.Enabled = True Catch ex As Exception If DevMode Then MsgBox(ex.Message) End Try End Sub Private Sub RecieveCallback(ByVal ar As IAsyncResult) Try Dim bytes() As Byte = CType(ar.AsyncState, Byte()) Dim numbytes As Int64 = ClientSocket.EndReceive(ar) If numbytes = 0 Then ClientSocket.Shutdown(SocketShutdown.Both) ClientSocket.Close() Dim dlg As New NoParamsDelegate(AddressOf DisconnectedUI) Me.Invoke(dlg) Else Dim Recv As String = ASCII.GetString(bytes, 0, numbytes) 'clear array Array.Clear(bytes, 0, bytes.Length) 'show UI Dim dlg As New OneStringDelegate(AddressOf DisplayRevievedData) Dim args() As Object = {Recv} Me.Invoke(dlg, args) 'begin recieving again ClientSocket.BeginReceive(bytes, 0, bytes.Length, SocketFlags.None, AddressOf RecieveCallback, bytes) End If Catch ex As Exception If DevMode Then MsgBox(ex.Message) End Try End Sub Private Delegate Sub OneStringDelegate(ByVal data As String) Private Sub DisplayRevievedData(ByVal data As String) Try MsgBox(Data) Catch ex As Exception If DevMode Then MsgBox(ex.Message) End Try End Sub I havent commented any code because I found it on the net. This is the imports, Variables and the subs/function I use to connect. (Left out the windows design generated code). It just wont connect, I get now error message. //Andi
  5. [PLAIN][socket] Client Connect to Local server but not to remote server...[/PLAIN] Hi. Im making a little server application just to get to know a little about TCPListener and TCP Client. I found some working code on som page on the net and I have one tiny little problem (Zip attached). I made to application On Server and one Client. The problem, i think, is in the server application. I can connect to the server with my client app locally on my computer but when I moved the server application to another computer (home network) and now I cant connect with my client. It works locally but not over my network. Any ideas what can cause this? I've checked our firewalls and all i OK there (Full Rights). Any ideas? SocketServer.zip
  6. HI I was wundering about three things. 1. How can I print screen only by pressing a button on my form? EDIT: Founde answer here: MSDN 2. Is it possible to take print screen on a specific open application? Like when I press the button it takes a screen cap on my IE Browser if its open or any other application? 3. How do I save the printed screen that is now in my clipboard, to a JPEG on my HDD? Any ideas? Maybe som tutorial or some other things I should look up? //Andi
  7. ok...im gonna change it to something easier...thanks
  8. Im making a file renamer tool...
  9. Hi. Im using OpenFileDialog to load som files into a list box but I have one little problem. The problem is that when I open, I think ~200 files, using multiselect I get the error "You open to many files, open less files" or something like that. Is there a way to go around that? Or do I have to make a custom OpenFileDialog? //Andi
  10. I know, but I just wundered if I could add it to the slider, because it's a long way to go.
  11. Hi I was wundering if it is possible to add the resolution 640*480 to the slider that you find in the settings. U know: Start -> Control Panel -> Monitor -> Settings There is a slider so u drag it and chang ur resolution. But in winxp 640*480 reolution is gone. How can I add it? //Andi
  12. The name part, should that be only the filename with the extension or the whole filepath thing C:\filename.type?
  13. Hi. How do I rename files that I have in a dir? I can get the pathname and filename but I don't know how to rename the file without copying the file first. Any ideas?
  14. well the dropdownlist its in its own sub and I puted the If Page.IsPostBack Then Exit Sub in it så its the same. But I will keep it in mind. Thanx again
  15. I just load it every time Edit: You gave me a hint with the Postback thingie... I made a if-selecten if the page is post back the exit sub. And now it works. Thanx
×
×
  • Create New...