2,245 Posted Topics
Re: Try this: [code] using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace daniweb { public partial class frmGridView2 : Form { DataTable dt; private TextBox editingBox; //I cant find where the gridView holds the reference public frmGridView2() { InitializeComponent(); editingBox = default(TextBox); … | |
Re: Is the input fixed at all? You could use a MaskedTextBox and set the mask to a numeric mask. There is also a numeric control you could use: [url]http://www.codeproject.com/KB/edit/TNumEditBox.aspx[/url] | |
Re: Please use code tags in the future [code = VB.NET] <- Remove the spaces and it will work code here [/code] To answer your question you should move the functionality to another method instead of calling the button's click event, but: [code=vb.net] Private Sub Button1_Click(ByVal sender As System.Object, ByVal e … | |
Re: That is not enough information. You can use the import/export wizard built in the SQL Server Management studio. Excel has a limit ~65535 if i recall correctly (may be more in the newer version) so you might not be able to export all of your data. Also do you want … | |
Re: Post the [icode]CREATE TABLE[/icode] SQL for you Customer table. Is the CustomerId an integral field? | |
Re: [QUOTE=phalaris_trip;928954] I wonder if there's a way to force the OS to invalidate or something...[/QUOTE] Invalidate just causes the invalidated region of the screen/form to be redrawn. You need explorer to truly do a refresh of the data subset to display the files. Refreshing explorer: [url]http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/2ca36f68-d70d-4012-a5fb-4580be9b344f[/url] | |
Re: Look at the output window after you click the button. Do you see an exception similar to: [code]A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll[/code] ![]() | |
Re: You can use a one-liner ;) [code] textBox1.Enabled = checkBox1.Checked; [/code] DIPY -- Are you getting a callstack overflow error? I'm looking at the code you pasted and in the event you are changing the check status of the checkbox that fired the event. [code] public void Checked_Changed(Object sender, EventArgs … | |
Re: This should do the trick for you. [code=csharp] private void frmGridView_Load(object sender, EventArgs e) { this.customerTableAdapter.Fill(this.dataSet1.Customer); } private void button1_Click(object sender, EventArgs e) { DataSet ds = new DataSet(); DataTable dt = new DataTable(); dt.TableName = "MyTable"; foreach (DataGridViewColumn col in dataGridView1.Columns) { dt.Columns.Add(col.DataPropertyName, col.ValueType); } foreach (DataGridViewRow gridRow in … | |
Re: The above answers are 'technically' incorrect (but deceptikon did a great job explaining it). Exceptions are very expensive to be thrown, but are of little cost to be caught (not no cost). This is especially noticeable if they are thrown in code that is commonly called (painting, calculations, etc). try..catch{} … | |
Re: Try this: [code] using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace daniweb.mdi { public partial class frmMain : Form { public frmMain() { InitializeComponent(); } private Form OpenForm(Type t) { if (!t.IsSubclassOf(typeof(Form)) && !(t == typeof(Form))) throw new ArgumentException("Type is not … | |
Re: I suppose it may be possible for `cert.SubjectName` to be null or `cert.SubjectName.Name` to be null. Also this part is incorrect: catch (Exception e) { throw e; } When you do that it re-throws the exception with new line numbers -- thus makes harder chasing down the actual problem. There … | |
Re: Please ZIP your project and attach it here. There is code involved aside from what you posted. | |
Re: See: [URL="http://www.daniweb.com/web-development/databases/ms-sql/threads/287090"]Thread #1[/URL] [URL="http://www.daniweb.com/web-development/databases/ms-sql/threads/378099"]Thread #2[/URL] And this code snippet: [code] /// <summary> /// Verifies strong password against SQL 2008 settings /// </summary> /// <param name="password"></param> /// <returns></returns> [CustomAction] public static ActionResult IsSql2008StrongPassword(Session session) { session[PropertyNames.Apex_SqlFieldsValid] = "0"; //See: http://msdn.microsoft.com/en-us/library/cc281849.aspx #region password validation { //#1 - Done //Strong passwords are not … | |
Re: [code] using System; using System.Collections.Generic; using System.Linq; using System.Net.NetworkInformation; using System.Net.Sockets; namespace SerialTester { class NetworkHelper { static NetworkInterface[] GetAllNetworkInterfacesSafe() { try { return NetworkInterface.GetAllNetworkInterfaces() .Where(nic => (nic.IsReceiveOnly == false) && (nic.NetworkInterfaceType != NetworkInterfaceType.Loopback) && (nic.OperationalStatus == OperationalStatus.Up)) .ToArray(); } catch (Exception ex) { //log4net if (log.IsErrorEnabled) log.Error("Error retrieving network … | |
Re: Try doing a [icode]chmod -R 744 <dir>[/icode] on the directory. You will need to clean up the perms after you run that command. A directory in *nix needs the +x in order for you to "cd" in to it. [code=bash] sk@sk:/tmp/x$ ls -al total 9 drwxr--r-- 2 sk wheel 1024 … | |
Re: I think this is what you want. Hard to say without the table structures or an accurate description. [code=sql] Select ID, Name, ( Select Sum(Points) From Table2 Where Table2.ID = Table1.ID ) As Total From Table1 Where ID >= 1 and ID <= 3 Order By ID [/code] | |
Re: [QUOTE=dnanetwork;918412]use application variable....works... 100%[/QUOTE] Application variables are not persisted and you will lose the count data. You can also take a look at a free application called smarter stats for weblog analysis. There is a lot more information to be had from IIS log files then the number of times … | |
Re: [url]http://www.daniweb.com/software-development/csharp/code/217409[/url] | |
Re: Paste sample code. You can do as much as you would like to in another thread. However BE WARNED you should _copy_ any [icode]byte[][/icode] buffers sent/received to any socket / serial ports. The memory is pinned by the CLR and modifying it will lead to rare but incredibly hard to … | |
Re: If you can get ahold of your printer graphics or create an image you will find a [icode].VerticalResolution[/icode] and [icode].HorizontalResolution[/icode] that will give you the pixels per inch as danny indicated. Do the math and draw your shapes to the size you want and send them to the printer with … | |
Re: You should be using parameterized SQL. Its a lot easier to read queries and ensure you're not having datatype mismatches. [code] Imports System.Data.SqlClient Imports System.Text Public Class Form1 'Create Table TestTable '( ' Column1 varchar(100) PRIMARY KEY NOT NULL ') Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click … | |
Re: What are you trying to do? Normally with a ping its along the lines of "are you there (echo request)?. Yes I am (echo response)." You normally don't want to populate any sort of buffer with pings (ICMP) unless you have a specific purpose for doing so. As far as … | |
Re: Here are some network extensions that should help you out: [code=c#] static IEnumerable<UnicastIPAddressInformation> GetLocalIPv4Bindings() { NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface ni in interfaces) { IPInterfaceProperties props; try { props = ni.GetIPProperties(); } catch { continue; } for (int i1 = 0; i1 < props.UnicastAddresses.Count; i1++) { if (props.UnicastAddresses[i1].Address.AddressFamily == … | |
Re: No. Columns depend entirely on the resultant dataset. | |
Re: Try this: [code=c#] void button1_Click(object sender, EventArgs e) { string s = Console.ReadLine(); System.IO.File.WriteAllText(@"C:\path\to\file.txt", s); } [/code] | |
This morning: [QUOTE] Total Down-Votes Received: [B][COLOR="Red"]33[/COLOR][/B] Unique Posts Receiving Down-Votes: 29 Individual Members Who've Down-Voted: [B][COLOR="Red"]6[/COLOR][/B] Posts Currently Negative: 13 [/QUOTE] Now: [QUOTE] Total Down-Votes Received: [B][COLOR="red"]61[/COLOR][/B] Unique Posts Receiving Down-Votes: 56 Individual Members Who've Down-Voted: [COLOR="red"][B]7[/B][/COLOR] Posts Currently Negative: 34 [/QUOTE] So one new person cast a vote … | |
Re: Well it depends on how you want the scripts to interact with eachother. If you want to share environment variables that have not been exported then you would call the file with [icode]. /path/to/file.sh[/icode] or [icode]source /path/to/file.sh[/icode]. If you don't want to share the environment of the script you would … | |
Re: Click on the installer in your solution explorer and look in the properties window. Set these properties: DetectNewerInstalledVersion = True RemovePreviousVersions = True That will allow you to upgrade machines and stop accidental downgrades. | |
Re: Please use code tags when posting code on daniweb: Which is why you should use the application data path for storing files so you dont run in to that issue: `string newPath = Path.Combine(Application.UserAppDataPath, "Download.txt");` You can take a look at the drive letter of the user app data path … | |
Re: You may also consider using [icode]Regex.Split()[/icode] to split on word boundaries and filter out the punctuation. If you split on ' ' and you have "hi\r\nhello" then it will show up as one word because but its really on two different lines. I suppose if you use [icode].ReadLine()[/icode] for the … | |
![]() | Re: I think you are referring to the difference between encapsulation vs inheritence. They are well documented topics on the net so look up a few articles and see if that answers your question. If not post then please post back. ![]() |
Re: Taking a step back -- what exactly are you trying to do here? If you want absolute performance than managed code is not the answer. The ability to control struct layouts is present for interop reasons. For example see [URL="http://www.daniweb.com/software-development/csharp/threads/370676"]this thread[/URL]. You can instantiate structs faster than classes sure but … | |
Re: Have the developer download wireshark or better yet run wireshark on the server. Start the packet capture before he attempts to copy the files and run it for ~15 seconds after the packet capture fails. Take the PCAP file and upload it here or send me a private message (see … | |
Re: Can you post your latest copy of both .NET and Delphi source? This does not make sense: [code=c#] private void btnRX_Click(object sender, EventArgs e) { byte[] Data = new byte[256]; int i; string s; if (!(checkBox1.Checked)) { toolStripStatusLabel1.Text = "Bidirectional operation not allowed"; return; } for (i = 0; i … | |
Re: More ports than 1433 are typically involved in an SQL connection. Here is a batch file for opening ports on a default instance (non-named instance) of SQL: [code] netsh firewall set portopening TCP 1433 "SQLServer" netsh firewall set portopening TCP 1434 "SQL Admin Connection" netsh firewall set portopening TCP 4022 … | |
Re: The "attachment" in your content-disposition instructs the browser to prompt for saving. The desired behavior you're describing is inline: [code=c#] if (view) Response.AddHeader("Content-Disposition", "inline; filename = " + file.OriginalFileName); else Response.AddHeader("Content-Disposition", "attachment; filename = " + file.OriginalFileName); [/code] | |
Re: [QUOTE=router.exe;1635438]it does appear to write to a local file...i think. the elevation window does not give me a lot of details. the application appears to have it's own updater, as in another exe file other than the program itself, and that is what is causing the need for elevation.[/QUOTE] I … | |
Re: [QUOTE=Ketsuekiame;1636675]Yes, but I suggest not doing so and therefore will not say. "Catching" your entire program is ridiculously bad design and implementation. Fix your bugs, don't hide them.[/QUOTE] I wholeheartedly disagree. Per Microsoft if you want your software to be logo certified (Certified for Windows 7, etc) you are not … | |
Re: Here is how I handle reading masked bits: [code] public static class BITS { public const byte BIT0 = 0x01; public const byte BIT1 = 0x02; public const byte BIT2 = 0x04; public const byte BIT3 = 0x08; public const byte BIT4 = 0x10; public const byte BIT5 = 0x20; … | |
Re: This is commonly referred to as a pivot. [code] IF OBJECT_ID('tempdb..#Parts', 'U') IS NOT NULL DROP TABLE #Parts Create Table #Parts ( ID int, ID2 int, PartNo varchar(10) ) SET NOCOUNT ON Insert Into #Parts (ID, ID2, PartNo) Values (75, 23921, 'DENT') Insert Into #Parts (ID, ID2, PartNo) Values (75, … | |
Re: I believe your problem lies outside of the code shown here. Could you zip your project and upload it to this thread? | |
Re: Don't install SQL 2008. Use SQL 2008R2 or SQL 2005. My software ships with SQL 2008R2 and I have had a few problems installing SQL server on home editions of windows due to missing privilieges. The below code has the privileges in question and an article: [code=c#] #region security token … | |
Re: Group by every column you select. If the duplicates are somehow coming from a join it will still be eliminated in a group by. Example: [code=sql] IF OBJECT_ID('tempdb..#Table', 'U') IS NOT NULL DROP TABLE #Table GO Create Table #Table ( Id int identity(1000, 1) PRIMARY KEY, Name varchar(100) ) SET … | |
Re: I think you may mean FFF0 is hex. If so that is 2 bytes (32-bit). Other than that I can't really make sense of your question. The definition of first and last depends on [URL="http://en.wikipedia.org/wiki/Endianness"]endianness[/URL]. [code=c#] public static class BITS { public const byte BIT0 = 0x01; public const byte … | |
Re: Those two metrics are not necessarily related. Ping is round-trip latency, ie "it takes 300ms to send a packet then receive a response from the host". As you begin downloading it increases congestion on the line and results and in higher packet round-trip times. This is probably a question of … | |
Re: - Right click on the project in visual studio and select "open folder in windows explorer". - Close visual studio - Make a copy of the *.csproj file (backup) - Open the *.csproj file in notepad - Search for the resource name. You should see two duplicate entries. Delete one … | |
Re: [QUOTE=udigold1;1605693]Why this is happening? How can I make it color the cells right from the beginning?[/QUOTE] You don't want to. Classes inheriting from controls (including forms) rarely need code in the constructor aside from designer generated code. You should place this code in the form's Load event. A lot of … | |
Re: It executes line 3 and 4 over and over again: [code] cd "C:/" md "PC Killar" cd "C:/" md "PC Killar" cd "C:/" md "PC Killar" cd "C:/" md "PC Killar" cd "C:/" md "PC Killar" ..etc... [/code] I wouldn't really call that a virus. Just a nuisance batch file. |
The End.