698 Posted Topics

Member Avatar for sidd.

There is a quirk with Math.Round. It defaults to rounding to the nearest even number, so 1.5 = 2, 2.5 = 2. If you use [iCODE]Math.Round(2.5, MidpointRounding.AwayFromZero)[/iCODE] it will round to the nearest whole number.

Member Avatar for Geekitygeek
0
197
Member Avatar for villeson

You are making a lot of extra work for yourself. If you are always going to store 10 teams and each team always has 25 players then a 2D array is perfect (as kplcjl mentioned). First dimension is teams, second is players: [CODE] Label[,] teamList = new Label[10,25]; teamList[0,0] = …

Member Avatar for Geekitygeek
0
86
Member Avatar for Medic873

As diamond drake said, it is beyond unlikely that the colour you are looking for will appear in a single pixel on the screen. You are more likely to find a large collection of locations. Diamonddrake's suggestion of finding the area of highest saturation would be a good approach. Not …

Member Avatar for Geekitygeek
0
86
Member Avatar for charqus

adatapost and SharpJohnnyG are both correct, depending on what you meant. Can you clarify your question. Are you trying to alter the text that appears above each page (eg "tabPage1") or are you trying to place text inside the tab page itself. If its the first, then what SharpJohnnyG said …

Member Avatar for Geekitygeek
0
99
Member Avatar for elmaco93

Your problem is that you are opening the StreamWriter at the top of your code, even though you might not use it. If the file already holds a value then the streamwriter isnt used, then when it is disposed at the end of the method it saves its contents to …

Member Avatar for elmaco93
0
119
Member Avatar for badx

Therror messages are there to help you find the problem. I know as a novice they can be confusing, but it will help you a lot if you learn to understand what they are telling you. You said you didnt notice that you had 2SERIAL_NO instead of @SERIAL_NO, but that …

Member Avatar for Geekitygeek
0
151
Member Avatar for sjfleming

Whats your question? You said the code adatapost gave you worked ok but havent said what elese you actually need help with :)

Member Avatar for sjfleming
0
8K
Member Avatar for Eternity[LK]

My first thought was the same as jonsca's. If you want to make it impossible for the button to be clicked, set the buttons Enabled property to False. Then it doesnt matter if they can move the pmouse over them or use the keys. The button is visible but disabled …

Member Avatar for Geekitygeek
0
2K
Member Avatar for Geekitygeek

Not sure if the title is the correct term for this, but i want to replicate the mailmerge style functionality in one of my apps. In other words, i would like to bind a keyword to a database field. For instance, whilst writing a description for a new stock item …

Member Avatar for Geekitygeek
1
82
Member Avatar for Mapopa

As adatapost has said, the policy here at Daniweb is to help those who have shown effort first. To get you started, at the design stage you need to break down the problem into individual steps, then solve each of them. This is first achieved in pseudocode. You need to …

Member Avatar for Geekitygeek
0
116
Member Avatar for vilas_tadoori

Here you go: [CODE] private void checkBox1_CheckedChanged(object sender, EventArgs e) { textBox1.Visible = !checkBox1.Checked; } [/CODE] Each time the checkboxes checked value is changed the textboxes visible property will be set to the opposite.

Member Avatar for Geekitygeek
0
96
Member Avatar for chetanbasuray

Ok, firstly, why is this a poll? It needn't be and thats probably why you have received down votes. Secondly, your question stated that "balance is calculated as opening_balance(from 1st table) + quantity_purchased(from 2nd table) - no_of_issue(from 3rd table)." Adatapost has given you the queries you need to retrieve each …

Member Avatar for chetanbasuray
-3
152
Member Avatar for fxpepper

kplcjl, your quick quiz highlights some important issues relating to inheritance and reference types. But i think someone just setting out in c# might struggle to understand the 'why' of the answers if they manage to find them at all. For the OP's benefit; classes are a reference type. When …

Member Avatar for kplcjl
1
558
Member Avatar for HiImBen

Also, look at using int.TryParse rather than Parse. TryParse will copy the value to an output variable and returns a boolean value to show wether the parse succeeded. int.Parse will throw an exception if the user doesnt enter a valid number. [CODE] Console.WriteLine("Please enter which shipping method you want:"); Console.WriteLine("Enter …

Member Avatar for kplcjl
0
134
Member Avatar for eaon21

This is a common mistake amongst new coders. You must ensure that all code paths assign a value before you try to access it. As jonsca pointed out, you are assigning inside if/else statements, but if your code path doesnt fit any of your conditions then it misses all of …

Member Avatar for Geekitygeek
0
233
Member Avatar for nasir.ud

What problems are shown at the line "pictureBox1.Image = Image.FromStream(stmBLOBData,false,false);", can you give a specific error message?

Member Avatar for ddanbe
0
2K
Member Avatar for gambit_1607

Whilst his reply may sound harsh, i have to agree with diamonddrake on this one. I enjoy helping others to learn the finer points of coding and to overcome odd/challenging problems in their code. But there is an abundance of information (both here on Daniweb and on the internet in …

Member Avatar for Geekitygeek
0
423
Member Avatar for coollife

I'll second the BackgroundWorker. By running the decryption in a background worker it wont lock up your UI thread, and turning on ReportsProgress will allow you to relay the data back tou your main form to update the progress bar.

Member Avatar for Geekitygeek
0
187
Member Avatar for skg123
Member Avatar for skg123
0
112
Member Avatar for misfits86

You have been asked for pseudo code, what you have posted is C# code (i use the term loosely). You need to focus on working out the flow of the program and the processes you need at each stage (ie, read in a number, store the number, sort array, find …

Member Avatar for Geekitygeek
-3
662
Member Avatar for ticktock

The problem stems from the 'nameLast = Convert.ToString(Console.ReadLine());' being passed over/not processed on the second loop. I tracked the source down to the line in the code below. By using ReadLine isntead of Read it fixes the problem. I am not entirely sure why this is though. Perhaps someone more …

Member Avatar for ticktock
0
1K
Member Avatar for MARKAND911

Just to clarify, you say you want to load "images" (plural) into a picturebox (singular). What were you hoping to achieve? If you wanted to load more than one image you can use a foreach loop: [CODE]foreach (string file in Directory.GetFiles(@"C:\Pictures", "*.jpeg", SearchOption.AllDirectories)) { }[/CODE] But you would need some …

Member Avatar for kdcorp87
0
115
Member Avatar for zachattack05

To expand on what adatapost said, you can search the Application.OpenForms collection by name: [CODE] frmEditorAccounts Accounts = Application.OpenForms["frmEditorAccounts "] as frmEditorAccounts [/CODE] Also, depending on how you have designed your forms, you may want to alter the WindowState of the form as well as bringing it to the front …

Member Avatar for zachattack05
0
3K
Member Avatar for tqmd1

another way is to use if-else structure: [CODE] If e.ColumnIndex = 3 Then If Not IsNumeric(e.FormattedValue) Then DataGridView1.Rows(e.RowIndex).ErrorText = " must be a numeric value" MsgBox("Must be a numeric value") DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells(3).Value = Nothing e.Cancel = True ElseIf (e.FormattedValue.ToString = "0") Then e.Cancel = True MsgBox(" must be greater than 0") …

Member Avatar for Geekitygeek
0
92
Member Avatar for baloo8

In this situation, i tend to make a class or struct to hold my listview items. You can either use DisplayMember and ValueMember to control what is shown and returned: [CODE] private void Form1_Load(object sender, EventArgs e) { ListBoxItem newItem = new ListBoxItem(); newItem.ID = 4; newItem.name = "Joe Bloggs"; …

Member Avatar for Geekitygeek
0
224
Member Avatar for Joelles

You aren't initialising an instance of the IrcBot class. You need to either make the class static if you plan to use a single instance of it or you need to create an instance to use inside your Run method: [CODE] IrcBot botInstance = new IrcBot(); [/CODE]

Member Avatar for Geekitygeek
0
149
Member Avatar for chromatinpt

Can you clarify, when you say you need 1 decimal number, do you mean you want a whole number (no '.' and no decimal value) or do you mean you wnat a number with 1 number after the '.' (a decimal with one significant figure)?

Member Avatar for chromatinpt
0
79
Member Avatar for MxDev

Its not possible with the OpenFileDialog. You would probably need to roll your own control. A simple form with a listbox would do(see attached image). Code: [CODE] public partial class FileDialog : Form { public FileDialog() { InitializeComponent(); } private void FileDialog_Load(object sender, EventArgs e) { //directory to retrieve files …

Member Avatar for Kiran.dks
0
185
Member Avatar for sknake

I would love to see this implemented...add an individuals group memeberships to the Community Centre, or have an optional setting to add a menu beside the current ones...or at least add email notifications to subscribed group discussions :D

Member Avatar for Geekitygeek
0
349
Member Avatar for MasterPengwin

If you want to catch keyboard events without your app having focus i think you will need to use a global keyboard hook. Check out [URL="http://www.codeproject.com/KB/cs/globalhook.aspx"]this link[/URL] to get you started.

Member Avatar for Diamonddrake
0
162
Member Avatar for chathuD

It helps if you offer a little more information about what "THIS SORT OF THING" is. You have two button1_click event handlers there, and if i've read it right, you are displaying the password instead of checking it.

Member Avatar for Geekitygeek
-2
95
Member Avatar for farheen86

hi, The problem is that 'user' is a sql keyword. Whilst it is syntactically possible to use keywords, it is best to avoid them. It is similar to trying to declare an variable like [iCODE]decimal decimal = 2;[/iCODE]. In C# this throws an error, in SQL it will allow it. …

Member Avatar for Geekitygeek
0
161
Member Avatar for DevC++4.9.9.2

I would imagine the error is a foreign key constraint problem. Referential integrity requires that a foreign key value has a matching value in the primary key table. In other words, you cant have a contract that references a band that doesnt exist. Easiest way to overcome this would be …

Member Avatar for DevC++4.9.9.2
0
247
Member Avatar for medopunsher

Im curious, why are you using a form? Are you trying to produce a custom pop-up? I usually use a panel which i position then show/hide rather than using a seperate form. If you use a form i think it will get focus when opened which may fire off extra …

Member Avatar for Geekitygeek
0
160
Member Avatar for Geekitygeek

Hi, I have a datagridview which displays customer orders. I have implemented a search panel with various options to narrow down the subset of orders by applying a string of filters to the bindingsource. I have also added an unbound checkbox column to allow the user to select/deselect orders along …

Member Avatar for sknake
0
275
Member Avatar for Hidden-Coder

Also, if your going to be trying out regex, i found [URL="http://gskinner.com/RegExr/"]this online tool[/URL] to be quite handy. Alternatively, you can download a free version of [URL="http://www.ultrapico.com/Expresso.htm"]Expresso[/URL]...great tool for putting together complex regular expressions, you can break it down into sections etc. Helped me get a handle on them :)

Member Avatar for Hidden-Coder
0
160
Member Avatar for firebirds98
Member Avatar for makdu

Unless your application is threaded, a while loop will lock the application. Each time your form processes an event it will run [B]all[/B] code associated with that event. Any other events will wait in the message queue until the code finishes. If you have an event which contains a while …

Member Avatar for makdu
0
247
Member Avatar for thanatos2

at the bottom of the page, just above the reply box is a link that says "Mark As Solved" :) Remember to come back if you need help with your sort

Member Avatar for Geekitygeek
0
137
Member Avatar for mrnutty

I have been a geek for years but i hit my ultimate geekiness yesterday: i was doing rough sketches of entity relationships for a database design. Key point here; i was using good ol' pen and paper. The geeky bit was when i started a second diagram and for an …

Member Avatar for mrnutty
1
329
Member Avatar for sathya8819

Hiya, Something like this: [CODE] string folderPath = @"C:\Users\Dan\Pictures"; string[] fileList = Directory.GetFiles(folderPath); foreach (string file in fileList) { //do something to file //'file' contains path as string } [/CODE] or if you want to select a folder at run time you can look at a FolderBrowserDialog rather than hardcoding …

Member Avatar for sathya8819
0
325
Member Avatar for Nerathas

[CODE] while (Count <= Number) { Count = Count * Count; Console.WriteLine("{0}", Count); Count = Count + 1; }Console.Write("Give in a number..."); ulong Number = ulong.Parse(Console.ReadLine()); ulong Count = 1; while (Count <= Number) { Count = Count * Count; // <-- you're problem is here Console.WriteLine("{0}", Count); Count = …

Member Avatar for Geekitygeek
0
108
Member Avatar for zzbottom

What ddanbe is suggesting is a more OO correct way to approach your problem. By creating a class to store the information relating to a Person you can then create an array of "People". To just store ID and Description you will need a 2-dimensional array. Since a standard array …

Member Avatar for jonsca
0
128
Member Avatar for Geekitygeek

Hi Guys, Firstly, Happy New Year!! Second, here my first query of the new year: I am using a stored proceedure to retrieve records from a database that match a number of search parameters. I now want to show a subset of those records in my Datagridview. I [B]don't[/B], however, …

Member Avatar for Geekitygeek
2
147
Member Avatar for capiono

First of all, unless you intend to programmatically set the selected index of the combobox, you dont need the set {} value in your property. You can create it as a read only property: [CODE] public int selectMonthIndex { get { return monthSelection.SelectedIndex; } } [/CODE] The way a property …

Member Avatar for Geekitygeek
0
2K
Member Avatar for Ulukay

You need to set TabStop = False on [B]every[/B] control in your form if you want the tab key to register in the KeyDown event. If even a single control that can receive focus has its TabStop property set to true the Tab key wont register.

Member Avatar for LennieKuah
0
140
Member Avatar for Krstevski

If you just wanted a rough progress, you could use [iCODE]progressBar1.Maximum = Directory.GetDirectories(rootDirectory).Length;[/iCODE] to find the number of directories to check. Then then increment the progress bar's value after each directory is checked. It wont be nearly as accurate as DdoubleD's method, but it is simpler to code and gives …

Member Avatar for Krstevski
0
654
Member Avatar for EllenHeijmans1

You say the 'column' relatiesoort exists, but what is the name/index of the table in the dataset? When you use a dataset for the datasrouce you specify the table to use eg [iCODE]ComboBox1.DataSource = ds.Tables("tablename")[/iCODE] or [iCODE]ComboBox1.DataSource = ds.Tables(0)[/iCODE]. Once you have assigned the table you then set the Comboboxes …

Member Avatar for sem.live
0
93
Member Avatar for semab

As ddanbe said, the policy here at Daniweb is to help those who have shown reasonable effort. You need to attemp the problem and show us what you have so far then we will offer you advice on how to proceed :)

Member Avatar for semab
0
53
Member Avatar for raj_raj

If you have struggled for six months you cant have looked very far...the top result from my first google search returned [URL="http://www.codeproject.com/KB/vb/InsertUpdateDeleteSearch.aspx"]this[/URL].

Member Avatar for roychowdhury
0
205

The End.