Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programmers' lounge. (Programming-related discussions only)
New Posts  All Forums:Forum Nav:

Programmers' lounge. (Programming-related discussions only) - Page 69

post #681 of 1143
This should do the trick. After you have send the email, use thread.sleep(xxxx) x means milliseconds of delay.
Quote:
Originally Posted by tompsonn View Post

Throw the code on a separate thread and use Thread.Sleep to provide your "tick".
KM
(14 items)
 
KTechDev
(5 items)
 
 
CPUMotherboardGraphicsRAM
AMD FX 6100 Asrock 990FX Extreme 4 Powercolor 7870 2GB Gskill RipjawX 1600 CL9D 8GB 
Hard DriveOptical DriveCoolingOS
500GB WD Caviar Blue SATA 3.0 Samsung 22x SH-S222/223 Sata Noctua NH-D14 Windows 7 Ultimate 64bit 
MonitorPowerCase
21.5 Samsung LED Monitor Corsair GS800W Thermaltake Armor A60 
CPUMotherboardRAMOS
Intel Pentium G620 2.6GHz ASRock Z68 Pro3-M Corsair XMS 3 1333 8gb Windows Server 2008 R2 
Power
Antec Basic VP350W 
  hide details  
Reply
KM
(14 items)
 
KTechDev
(5 items)
 
 
CPUMotherboardGraphicsRAM
AMD FX 6100 Asrock 990FX Extreme 4 Powercolor 7870 2GB Gskill RipjawX 1600 CL9D 8GB 
Hard DriveOptical DriveCoolingOS
500GB WD Caviar Blue SATA 3.0 Samsung 22x SH-S222/223 Sata Noctua NH-D14 Windows 7 Ultimate 64bit 
MonitorPowerCase
21.5 Samsung LED Monitor Corsair GS800W Thermaltake Armor A60 
CPUMotherboardRAMOS
Intel Pentium G620 2.6GHz ASRock Z68 Pro3-M Corsair XMS 3 1333 8gb Windows Server 2008 R2 
Power
Antec Basic VP350W 
  hide details  
Reply
post #682 of 1143
Quote:
Originally Posted by kelvintheiah View Post

This should do the trick. After you have send the email, use thread.sleep(xxxx) x means milliseconds of delay.

worked perfect, as any programmer I came across another idea, I decided to have it display the last email it sent out, and when i tried to do it I kept getting cross thread problem. So, I used a invoke but I felt like it was just cutting corners

here is the source code to it.

http://pastebin.com/eJzYL8UK

is there a "cleaner" or more efficient way of doing that?
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
post #683 of 1143
Quote:
Originally Posted by andyroo89 View Post

worked perfect, as any programmer I came across another idea, I decided to have it display the last email it sent out, and when i tried to do it I kept getting cross thread problem. So, I used a invoke but I felt like it was just cutting corners

here is the source code to it.

http://pastebin.com/eJzYL8UK

is there a "cleaner" or more efficient way of doing that?

There are cleaner ways, yes, but really they all rely on Invoke. This is because you can't perform cross-thread UI operations so you need to marshal yourself to the thread that contains the UI element you want to perform the update on. Which is what Control.Invoke does - it sends a message to the UI element you wish to update to run your callback. Basically the runtime sends a message with a pointer to your delegate to that UI element.

Here's what happens when you call Control.Invoke - it calls down to a private method called MarshaledInvoke:
Code:
private object MarshaledInvoke(Control caller, Delegate method, object[] args, bool synchronous)
{
      int num;
      if (!this.IsHandleCreated)
      {
            throw new InvalidOperationException(SR.GetString("ErrorNoMarshalingThread"));
      }
      if (((ActiveXImpl) this.Properties.GetObject(PropActiveXImpl)) != null)
      {
            IntSecurity.UnmanagedCode.Demand();
      }
      bool flag = false;
      if ((SafeNativeMethods.GetWindowThreadProcessId(new HandleRef(this, this.Handle), out num) == SafeNativeMethods.GetCurrentThreadId()) && synchronous)
      {
            flag = true;
      }
      ExecutionContext executionContext = null;
      if (!flag)
      {
            executionContext = ExecutionContext.Capture();
      }
      ThreadMethodEntry entry = new ThreadMethodEntry(caller, this, method, args, synchronous, executionContext);
      lock (this)
      {
            if (this.threadCallbackList == null)
            {
                  this.threadCallbackList = new Queue();
            }
      }
      lock (this.threadCallbackList)
      {
            if (threadCallbackMessage == 0x0)
            {
                  threadCallbackMessage = SafeNativeMethods.RegisterWindowMessage(Application.WindowMessagesVersion + "_ThreadCallbackMessage");
            }
            this.threadCallbackList.Enqueue(entry);
      }
      if (flag)
      {
            this.InvokeMarshaledCallbacks();
      }
      else
      {
            UnsafeNativeMethods.PostMessage(new HandleRef(this, this.Handle), threadCallbackMessage, IntPtr.Zero, IntPtr.Zero);
      }
      if (!synchronous)
      {
            return entry;
      }
      if (!entry.IsCompleted)
      {
            this.WaitForWaitHandle(entry.AsyncWaitHandle);
      }
      if (entry.exception != null)
      {
            throw entry.exception;
      }
      return entry.retVal;
}
Ol' Sandy
(28 items)
 
"Zeus"
(12 items)
 
Elite Preview
(6 items)
 
CPUMotherboardGraphicsRAM
Intel Xeon E3-1230v3 Gigabyte GA-Z97X-UD5H-BK MSI Gaming GTX 980 Kingston 32GB (4x8) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Samsung EVO 1TB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 8 Pro 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2713HM Topre Realforce 87UB | Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Logitech G700 XTRAC Ripper XXL 
AudioAudioAudioAudio
Beyerdynamic DT-770 Pro 250ohm Schiit Bifrost DAC Schiit Asgard 2 HiVi Swan M50W 2.1 
CPUMotherboardRAMHard Drive
Intel Xeon E5-2620 Super Micro X9SRL-F-B 128GB 1333MHz LSI 9271-8i 
OSPowerCase
VMware ESXi 5.5 SeaSonic SS-400FL2 Fractal Define R3 
CPUMotherboardGraphicsRAM
Intel Core i5-3437U HP EliteBook Folio 9470m  Intel HD Graphics 4000  16GB DDR3 SDRAM 
Hard DriveOS
256GB SSD Windows 10 Insider Preview 
  hide details  
Reply
Ol' Sandy
(28 items)
 
"Zeus"
(12 items)
 
Elite Preview
(6 items)
 
CPUMotherboardGraphicsRAM
Intel Xeon E3-1230v3 Gigabyte GA-Z97X-UD5H-BK MSI Gaming GTX 980 Kingston 32GB (4x8) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Samsung EVO 1TB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 8 Pro 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2713HM Topre Realforce 87UB | Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Logitech G700 XTRAC Ripper XXL 
AudioAudioAudioAudio
Beyerdynamic DT-770 Pro 250ohm Schiit Bifrost DAC Schiit Asgard 2 HiVi Swan M50W 2.1 
CPUMotherboardRAMHard Drive
Intel Xeon E5-2620 Super Micro X9SRL-F-B 128GB 1333MHz LSI 9271-8i 
OSPowerCase
VMware ESXi 5.5 SeaSonic SS-400FL2 Fractal Define R3 
CPUMotherboardGraphicsRAM
Intel Core i5-3437U HP EliteBook Folio 9470m  Intel HD Graphics 4000  16GB DDR3 SDRAM 
Hard DriveOS
256GB SSD Windows 10 Insider Preview 
  hide details  
Reply
post #684 of 1143
I suggest opening a multiple-selection poll with IDEs to see which is most popular here on OCN smile.gif
My Rig
(14 items)
 
Ex-wife's Rig
(15 items)
 
 
CPUMotherboardGraphicsRAM
Core i5 4460 AsRock H81M-DG4 Sapphire Rx470 Platinum KVR 1600 16Gb 
Hard DriveHard DriveCoolingOS
2x Seagate 3Tb Samsung 850 EVO 120 Scythe Ninja 3 Rev.B Windows 10 Pro 
MonitorKeyboardPowerCase
Fujitsu Siemens A17-2A Logitech K280e SuperFlower SF-550K12XP Thermaltake Versa H25 
MouseAudio
Logitech G402 Sony MDR XD150 
CPUMotherboardGraphicsRAM
Athlon 750K 4.0Ghz AsRock FM2A75 Pro4+ Sapphire R9 270X Dual-X Kingston 2x4Gb 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 850 EVO 120  Western Digital 320Gb LiteON DVD-RW CoolerMaster Hyper Z600 
OSMonitorKeyboardPower
Windows 7 Pro x64 Toshiba 32" FullHD TV Logitech FSP Hexa 550 
CaseMouse
DeLUX Logitech 
  hide details  
Reply
My Rig
(14 items)
 
Ex-wife's Rig
(15 items)
 
 
CPUMotherboardGraphicsRAM
Core i5 4460 AsRock H81M-DG4 Sapphire Rx470 Platinum KVR 1600 16Gb 
Hard DriveHard DriveCoolingOS
2x Seagate 3Tb Samsung 850 EVO 120 Scythe Ninja 3 Rev.B Windows 10 Pro 
MonitorKeyboardPowerCase
Fujitsu Siemens A17-2A Logitech K280e SuperFlower SF-550K12XP Thermaltake Versa H25 
MouseAudio
Logitech G402 Sony MDR XD150 
CPUMotherboardGraphicsRAM
Athlon 750K 4.0Ghz AsRock FM2A75 Pro4+ Sapphire R9 270X Dual-X Kingston 2x4Gb 1600 
Hard DriveHard DriveOptical DriveCooling
Samsung 850 EVO 120  Western Digital 320Gb LiteON DVD-RW CoolerMaster Hyper Z600 
OSMonitorKeyboardPower
Windows 7 Pro x64 Toshiba 32" FullHD TV Logitech FSP Hexa 550 
CaseMouse
DeLUX Logitech 
  hide details  
Reply
post #685 of 1143
Ok, So I'm trying again, but this time with dynamic memory.
Code:
#include <stdio.h>
#include <stdlib.h>

typedef struct{
    int clave;
    char nombre[50];
}DataBox;

typedef DataBox RegistroOrdenable;

int main()
{
    int n = 20000;
    RegistroOrdenable* orig_box1, orig_box2, orig_box3, //burbuja
                         box1, box2, box3; //I'm gonna recycle them all over and over

    orig_box1 = (RegistroOrdenable*)malloc(n*sizeof(RegistroOrdenable));
    orig_box2 = (RegistroOrdenable*)malloc(n*sizeof(RegistroOrdenable));
    orig_box3 = (RegistroOrdenable*)malloc(n*sizeof(RegistroOrdenable));
    box1 = (RegistroOrdenable*)malloc(n*sizeof(RegistroOrdenable));
    box2 = (RegistroOrdenable*)malloc(n*sizeof(RegistroOrdenable));
    box3 = (RegistroOrdenable*)malloc(n*sizeof(RegistroOrdenable));


    printf("Assignment succesful\n");
 
   return 0;
}

But on line 18 I get an error that says "Incompatible types when assigning to type 'RegistroOrdenable' from type 'struct RegistroOrdenable *'. Why is this happening?
fr0sty
(20 items)
 
SnowFlake
(5 items)
 
 
CPURAMHard DriveHard Drive
Intel Core i7 3520M  Corsair Vengeance DDR3 2x 8GB Samsung EVO SSD Hitachi Apple Hard Drive 5400RPM 
OS
macOS Sierra 
  hide details  
Reply
fr0sty
(20 items)
 
SnowFlake
(5 items)
 
 
CPURAMHard DriveHard Drive
Intel Core i7 3520M  Corsair Vengeance DDR3 2x 8GB Samsung EVO SSD Hitachi Apple Hard Drive 5400RPM 
OS
macOS Sierra 
  hide details  
Reply
post #686 of 1143
Quote:
Originally Posted by Icekilla View Post

Ok, So I'm trying again, but this time with dynamic memory.
Code:
#include <stdio.h>
#include <stdlib.h>

typedef struct{
    int clave;
    char nombre[50];
}DataBox;

typedef DataBox RegistroOrdenable;

int main()
{
    int n = 20000;
    RegistroOrdenable* orig_box1, orig_box2, orig_box3, //burbuja
                         box1, box2, box3; //I'm gonna recycle them all over and over

    orig_box1 = (RegistroOrdenable*)malloc(n*sizeof(RegistroOrdenable));
    orig_box2 = (RegistroOrdenable*)malloc(n*sizeof(RegistroOrdenable));
    orig_box3 = (RegistroOrdenable*)malloc(n*sizeof(RegistroOrdenable));
    box1 = (RegistroOrdenable*)malloc(n*sizeof(RegistroOrdenable));
    box2 = (RegistroOrdenable*)malloc(n*sizeof(RegistroOrdenable));
    box3 = (RegistroOrdenable*)malloc(n*sizeof(RegistroOrdenable));


    printf("Assignment succesful\n");
 
   return 0;
}

But on line 18 I get an error that says "Incompatible types when assigning to type 'RegistroOrdenable' from type 'struct RegistroOrdenable *'. Why is this happening?

Are you trying to create all of orig_box1, 2, 3 and box 1,2,3 as pointers? Because your current code only creates orig_box1 as a pointer RegistroOrdenable*, but creates the rest as RegistroOrdenable types, instead.

You should put the * sign, in front of each of the variables defined:
Code:
RegistroOrdenable *orig_box1, *orig_box2, *orig_box3, //burbuja
                         *box1, *box2, *box3; //I'm gonna recycle them all over and over
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
MacBook Pro 13"
(6 items)
 
 
Desktop
(13 items)
 
CPUGraphicsRAMHard Drive
Intel i5 3210 @ 2.5 GHz Intel HD4000 4 GB DDR3 @ 1600 MHz 500 GB @ 5400 RPM 
OSMonitor
OSX Mountain Lion 13.3" @ 1280 x 800 
CPUGraphicsRAMHard Drive
Intel i5 480m@2.67GHz AMD Radeon Mobility 5650 4GB DDR3 500GB 
OSMonitor
Windows 7 64bit HP 15.6" 1366x768 
CPUMotherboardGraphicsRAM
E7500 Intel...:( MSI GTS250 1GB 2GB 
Hard DriveOSMonitorPower
250GB Windows XP 17" LG CRT 1280x768@85hz 400W 
  hide details  
Reply
post #687 of 1143
Quote:
Originally Posted by {Unregistered} View Post

Are you trying to create all of orig_box1, 2, 3 and box 1,2,3 as pointers? Because your current code only creates orig_box1 as a pointer RegistroOrdenable*, but creates the rest as RegistroOrdenable types, instead.

You should put the * sign, in front of each of the variables defined:
Code:
RegistroOrdenable *orig_box1, *orig_box2, *orig_box3, //burbuja
                         *box1, *box2, *box3; //I'm gonna recycle them all over and over

Classic C mistake tongue.gif
+1
Ol' Sandy
(28 items)
 
"Zeus"
(12 items)
 
Elite Preview
(6 items)
 
CPUMotherboardGraphicsRAM
Intel Xeon E3-1230v3 Gigabyte GA-Z97X-UD5H-BK MSI Gaming GTX 980 Kingston 32GB (4x8) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Samsung EVO 1TB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 8 Pro 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2713HM Topre Realforce 87UB | Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Logitech G700 XTRAC Ripper XXL 
AudioAudioAudioAudio
Beyerdynamic DT-770 Pro 250ohm Schiit Bifrost DAC Schiit Asgard 2 HiVi Swan M50W 2.1 
CPUMotherboardRAMHard Drive
Intel Xeon E5-2620 Super Micro X9SRL-F-B 128GB 1333MHz LSI 9271-8i 
OSPowerCase
VMware ESXi 5.5 SeaSonic SS-400FL2 Fractal Define R3 
CPUMotherboardGraphicsRAM
Intel Core i5-3437U HP EliteBook Folio 9470m  Intel HD Graphics 4000  16GB DDR3 SDRAM 
Hard DriveOS
256GB SSD Windows 10 Insider Preview 
  hide details  
Reply
Ol' Sandy
(28 items)
 
"Zeus"
(12 items)
 
Elite Preview
(6 items)
 
CPUMotherboardGraphicsRAM
Intel Xeon E3-1230v3 Gigabyte GA-Z97X-UD5H-BK MSI Gaming GTX 980 Kingston 32GB (4x8) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Samsung EVO 1TB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 8 Pro 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2713HM Topre Realforce 87UB | Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Logitech G700 XTRAC Ripper XXL 
AudioAudioAudioAudio
Beyerdynamic DT-770 Pro 250ohm Schiit Bifrost DAC Schiit Asgard 2 HiVi Swan M50W 2.1 
CPUMotherboardRAMHard Drive
Intel Xeon E5-2620 Super Micro X9SRL-F-B 128GB 1333MHz LSI 9271-8i 
OSPowerCase
VMware ESXi 5.5 SeaSonic SS-400FL2 Fractal Define R3 
CPUMotherboardGraphicsRAM
Intel Core i5-3437U HP EliteBook Folio 9470m  Intel HD Graphics 4000  16GB DDR3 SDRAM 
Hard DriveOS
256GB SSD Windows 10 Insider Preview 
  hide details  
Reply
post #688 of 1143
Hey guys I am back with another question, I currently made a if statement to send emails if whether or not they have an email attachment. It works and all but its only working because of this
Code:
TextBox.CheckForIllegalCrossThreadCalls = false;

I feel like its bad programming practice to use a shortcut like this, and would like to know how can I properly program it

here is small example of how I have it.

if(textBox3.TextLength > 0)
{
do stuff here
}
else if(textBox3.TextLength == 0)
{
do stuff
}

so how would I do it in good practice?
Edited by andyroo89 - 6/2/13 at 8:30pm
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
post #689 of 1143
Quote:
Originally Posted by andyroo89 View Post

Hey guys I am back with another question, I currently made a if statement to send emails if whether or not they have an email attachment. It works and all but its only working because of this
Code:
TextBox.CheckForIllegalCrossThreadCalls = false;

I feel like its bad programming practice to use a shortcut like this, and would like to know how can I properly program it

here is small example of how I have it.

if(textBox3.TextLength > 0)
{
do stuff here
}
else if(textBox3.TextLength == 0)
{
do stuff
}

so how would I do it in good practice?
WPF or Winforms?
post #690 of 1143
Quote:
Originally Posted by 3930K View Post

WPF or Winforms?

winforms
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
Collecting Dust
(13 items)
 
Server
(9 items)
 
 
CPUMotherboardGraphicsRAM
E8400 3.0ghz OC @ 3.8GHz @ 1.36v DFI BLood Iron P35 none OCZ 2x 2gb DDR2 800 CAS @ 5-6-6-21 
Hard DriveOptical DriveOSMonitor
none none loonix ssh is my monitor 
KeyboardPowerCaseMouse
none Corsair 650 watts old pc case Logitech mx518 
Mouse Pad
none! 
CPUMotherboardGraphicsRAM
AMD Athlon 64 X2 Dual Core Processor 6000+ GX611AA-ABA m8300f onboard 1x 2GB OCZ RAM DDR 
Hard DriveOSMonitorPower
320gb + 1TB HDD xubuntu 14.04 SSH 350 watt 
Case
crappy HP case 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Programmers' lounge. (Programming-related discussions only)