Before I even started with C# last year I build some of those... in SS2005AS I always used Visual Studio to browse them, question is what is best way to implement those things in stand alone application? Some idea?
TrooperIronMan
Posts
-
Cube and Data mining on Forms, how? -
Making a count of unique elements in an arrayGot it... public Dictionary GetUniqueElementCollection(object[] PassedArray) { Dictionary ResultList = new Dictionary(); foreach (object origObject in PassedArray) { bool exist = false; foreach (KeyValuePair obj in ResultList) { if (obj.Key.Equals(origObject)) exist = true; } if (exist) { ResultList[origObject] += 1; } else { ResultList.Add(origObject, 1); } } return ResultList; } what do you think guys?
-
Making a count of unique elements in an arrayI was aware I can only take 5 elements... indeed it was only prototype I built before you gave me idea I should use hashtable... regular usage of this wouldn't be user input 5 strings from console... nor it should be in main at first place... it should be method... probably in separate class that is given array as argument... and it return (Hashtable) which contain unique elements and their count... My first try before Hashtable was actually 2 dimensional object array... but was tired of casting int in and out for count every time... so I switched to int array+arraylist... don't know which solution is more complex. I'll redo my code now with hash table... I know about conventions to never give single letter variable names... didn't do it on purpose... and would certainly rename this later if I was happy with approach... I already had bunch of commented code so it was mess... I always first comment things out I don't like... then move them beyond last } and only delete them after I have final release fully debugged... Sure I got some good read on generics so I hope that will give me some idea... Thanks guys for help, this was actually one of questions I had to solve on my job interview-test yesterday... other questions were more like this... combined with ADO.NET, few SQL only... and some .Net stuff.... like, what is base class in net... and such stuff... I messed up this one that is sure... ;P
-
Making a count of unique elements in an arrayGreat, got some solution on my own finally... though this sound better... I'll post mine in a so you can laugh bit... :D ;P but it does work...
class Program { static void Main(string[] args) { ArrayList ResultList = new ArrayList(); int[] repeatCount = new int[5]; object[] originalObjectArray = new object[5]; Console.WriteLine("Enter array"); for (int i = 0; i < 5; i++) originalObjectArray[i] = Console.ReadLine(); ResultList.Add(originalObjectArray[0]); repeatCount[0] = 1; int passCount = 0; foreach (object o in originalObjectArray) { if (passCount > 0) { bool upis = true; for (int i = 0; i < ResultList.Count; i++) { if (ResultList[i].Equals(o)) { repeatCount[i] += 1; upis = false; } } if (upis == true) { ResultList.Add(o); repeatCount[ResultList.Count - 1] = 1; } } passCount++; } for (int l = 0; l BTW how do I test if key is already in Hashtable?
-
Making a count of unique elements in an arrayFor given array of objects, I need to produce a another list or two-dimensional resulting array or something where each pair of values consists of a one unique element from the original array and the number of times that element appears in original array. Tried google, but as usual... of about 100 results none is even close to what I need. I know this is trivial... but again... I'm trying it for 3 hours and no solution...
-
Copy value from that table adapter to data grid cell, how?No one? Anyone please?
-
Exteranal config for Remoting cause big problemI still didn't got this working...
-
Copy value from that table adapter to data grid cell, how?OK this can give you some idea...
private void order_DetailsDataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (order_DetailsDataGridView.Columns[e.ColumnIndex].DataPropertyName == "ProductID") {this.getProductCurrentPriceTableAdapter.Fill (this.northWndDataSet.GetProductCurrentPrice, (int)order_DetailsDataGridView[e.ColumnIndex, e.RowIndex].Value); order_DetailsDataGridView[e.ColumnIndex + 1, e.RowIndex].Value = decimal.Parse(unitPriceTextBox.Text); } }
so instead last line I want something better, any idea? -
Copy value from that table adapter to data grid cell, how?What is best method to do this on Order Details data grid, when user select ProductID ProductPrice is automatically filled with value from Product table... and is on save written to Order details (so if price changed in Product table it will not be automatically updated in order details table (only when user select new product)? I already have idea, tried to do new table adapter that have parameter query that do just that, and have event celled edit call fill on new table adapter... only remaining problem is how to copy new value to existing tableadapter. I tried some work around things... but none is very professional so I'm looking for some elegant solution. So how to copy value from that table adapter to data grid cell if possible (I only managed to drag and drop new table adapter and create text box on form, so I copy value of text box to grid, not something I would like to do)?
-
Assign value of one column to otherSay I want to put in order details current price of product, but once it's assigned it stay as is (so if it's null copy from product table if not leave as is...). How to do this?
-
Data navigator?I have problem I use Northwind database to build some prototype application in C#. Thing is when I set on Orders to display me EployeeID and CustomerID as listbox, I can select data source so they show only Name instead of ID, but Value is indeed ID of those 2. However when I do this Datanavigator have no effect on those 2? Wonder why since doing same thign on column in data grid work just fine. Any idea? Not exactly ado question I guess so I hope it's right room...
-
Hi!wrong forum... this is more for people who already work something with c# for complete begin get good book... almost any will do good job...
-
Exteranal config for Remoting cause big problemAny idea guys, I tried bunch of mine, but none give expected results, guess it's something trivial..
-
Exteranal config for Remoting cause big problemOK I tried to double chech (5 times at least acctually) all things, still when I replace this code:
HttpChannel c = new HttpChannel(32469); ChannelServices.RegisterChannel(c); RemotingConfiguration.RegisterWellKnownServiceType( typeof(SimpleChatProgram_DLL.SimpleChatProgramLibrary), "RemoteMsgObj.soap", WellKnownObjectMode.Singleton);
with this oneRemotingConfiguration.Configure("App.config", false);
and this config file: my client app (very simple program btw), stop working it can't even start anymore... Server start just as usual, but doesn't work as expected... Any idea? -
n-tier in .net?Thanks... of
Bassam Saoud wrote:
of links here [^]
this one I already have 8/10 links visited (they are purple :D)... and on MSDN I know there is lot to read... but figured out their best text is for VB.net 2002, exactly one you posted right now actually... so although there is bunch of material I'm still not happy... but I'll keep searching. Instead can someone say, how often we actually use n-tier architecture in day by day examples? I know huge data-base things should be n-tier, but what about things that don't access net or some other shared resource? how about n-layer?
-
n-tier in .net?OK I searched google, msdn etc. but didn't find exactly what I need. Can someone provide decent reference on this topic (hope detailed enough with best practice examples etc.). Thanks!
-
Correct way of databinding of foreign key?This thing bother me some time already Say I have form that should display data about some student; one of thing it need to display is cityID which is just foreign key to some city in table city. How can I make it display name of city instead of ID, but write ID to table student. I tried to do this logical way but never worked, first if there is some data in base it'll show FK value instead on city name, second when I drop down list I get names of cities, but when I pick one from list I never can continue even though I selected value member as ID field not name field (in parent table). I tried any combination available still doesn't work as expected. all data is show in details mode and combo box is for cityID value... Any idea?
-
Good ideas for beginner programming??Marc Clifton wrote:
qualifies as "something on the next level"
Sound interesting but it's way ahead of one level up, I'm only doing c# for 2 months now... so maybe later who knows... I guess I'll just stick with ADO.NET 2.0 for now... that is next thing I need to learn good I guess... Still good ideas are welcome...
-
Good ideas for beginner programming??Guys I'm running out of ideas, I want to program something smart and creative so I can further advance my sqls :D So far I did programs like: Multi tab web browser (around web browser control) Mulit tab editor (rich text box, xml, etc)... by far best thing I did 1200 lines of code in this one :D Calculator (like standard win calc) Some picture viewers both MDI and simple... Some phone book program... Student evidential program (take care about student data, massive use of inheritance, abstract methods, arrays, printing, etc). Quad Media Player... can open 4 media files at once in one form... nice for comparing edited and unedited material... Fahrenheit-Celsius converter with events... and lot's of small things... Now I want to do something on next level... I don't want to involve much math in it... some level is fine... I want program to be usefull for something I do every day (or at least it's something someone would like to use every day)? Any idea is welcome?;P
-
How to figure out what is root folder of my program at start up? [modified]Radu Sorin wrote:
kinda' late but maybe it will help ... Application.StartupPath
Thanks... it's not late all things I do in C# for now are only my learning so more I know better... I'll implement all options to see if there is any difference...