Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. c# application hang plz help

c# application hang plz help

Scheduled Pinned Locked Moved C#
csharpgraphicsjsonhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    spider_vikas
    wrote on last edited by
    #1

    code is using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using RfidApiLib; using System.IO; using System.Data.SqlClient; using System.Threading; namespace Service_Ambu_Exit { public partial class Form1 : Form { RfidApi api = new RfidApi(); public int TagCnt = 0; string ip; string portNo; string p_type = ""; string p1 = ""; string arr1; int intcount = 0; public Form1() { InitializeComponent(); } private int connectReader() { try { StreamReader sr1 = new StreamReader("ipandport.txt"); string[] str2; string[] str3; string arr3; arr3 = sr1.ReadLine(); str2 = arr3.Split('='); ip = str2[1].Trim(); StreamReader sr3 = new StreamReader("ipandport.txt"); string arr2; arr2 = sr3.ReadLine(); arr2 = sr3.ReadLine(); str3 = arr2.Split('='); portNo = str3[1].Trim(); int status; int port; string s = ""; try { port = int.Parse(portNo); s = ip; } catch (Exception) { logfile("Please mention the valid ip address and port in settings file."); return 0; } status = api.TcpConnectReader(ip, port); if (status != 0) { logfile("Connect Reader Failed."); return 0; } if (ip == "172.16.100.3".Trim() || ip == "172.16.100.4".Trim()) { p1 = "STAFF".Trim(); } else if (ip == "172.16.100.5".Trim() || ip == "172.16.100.7".Trim() || ip == "172.16.100.6".Trim()) { p1 = "AMBULANCE".Trim(); } else if (ip == "172.16.100.2".Trim() || ip == "172.16.100.1".Trim()) { p1 = "BASEMENT".Trim(); } StreamReader sr = new StreamReader("RFSettings.txt"

    L 1 Reply Last reply
    0
    • S spider_vikas

      code is using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using RfidApiLib; using System.IO; using System.Data.SqlClient; using System.Threading; namespace Service_Ambu_Exit { public partial class Form1 : Form { RfidApi api = new RfidApi(); public int TagCnt = 0; string ip; string portNo; string p_type = ""; string p1 = ""; string arr1; int intcount = 0; public Form1() { InitializeComponent(); } private int connectReader() { try { StreamReader sr1 = new StreamReader("ipandport.txt"); string[] str2; string[] str3; string arr3; arr3 = sr1.ReadLine(); str2 = arr3.Split('='); ip = str2[1].Trim(); StreamReader sr3 = new StreamReader("ipandport.txt"); string arr2; arr2 = sr3.ReadLine(); arr2 = sr3.ReadLine(); str3 = arr2.Split('='); portNo = str3[1].Trim(); int status; int port; string s = ""; try { port = int.Parse(portNo); s = ip; } catch (Exception) { logfile("Please mention the valid ip address and port in settings file."); return 0; } status = api.TcpConnectReader(ip, port); if (status != 0) { logfile("Connect Reader Failed."); return 0; } if (ip == "172.16.100.3".Trim() || ip == "172.16.100.4".Trim()) { p1 = "STAFF".Trim(); } else if (ip == "172.16.100.5".Trim() || ip == "172.16.100.7".Trim() || ip == "172.16.100.6".Trim()) { p1 = "AMBULANCE".Trim(); } else if (ip == "172.16.100.2".Trim() || ip == "172.16.100.1".Trim()) { p1 = "BASEMENT".Trim(); } StreamReader sr = new StreamReader("RFSettings.txt"

      L Offline
      L Offline
      Lukasz Nowakowski
      wrote on last edited by
      #2

      1. You should use <pre> or <code> tag to format code properly. 2. You should debug your application and try find the problem yourself. You just wrote some code, it doesn't work, so you think someone on the internet will fix it for you? 3. Connected to number 2 - you should tell us more specifically, what the problem is. "application hang" in the subject isn't telling us to much. You think we will run your code and check, where does it hang? We won't. Firstly you only gave us part of the code ("code-behind" of your form), and we don't know what controls you have on this form. Secondly, it's your job to locate the problem, and then we can tell you how to fix it. And if you can't locate the problem, than you should find at least a piece of code, that's causing it. Most of us here are willing to help, but you should show us, that you've done something to solve the problem yourself.

      Don't forget to rate answer, that helped you. It will allow other people find their answers faster.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups