Jump to content
Xtreme .Net Talk

Shurikn

Avatar/Signature
  • Posts

    62
  • Joined

  • Last visited

Everything posted by Shurikn

  1. It was fixed by adding this line: area.AxisX.LabelAutoFitStyle = System.Web.UI.DataVisualization.Charting.LabelAutoFitStyles.None; The answer came from http://stackoverflow.com/questions/22140103/chart-control-customlabel-aligment
  2. Hello, I've been away from .Net developping for like 6 years, coming back and I had to create a chart, I was really pleased to see this control, but the way it works is kinda annoying, anyway, look at this picture : [ATTACH]5759._xfImport[/ATTACH] These are two charts, both the same one, the only difference is their width and height, but as you can see, on the smaller on, the labels are unaligned. At first I had the same problem with the bigger one, but increasing the distance between the from and to points when including the customlabel fixed it, however the same trick doesn't seem to be working for the smaller one. The points are added this way (these are random points added directly for now, it'll become automated in the future) serie1.Points.AddXY(1, 2000); area.AxisX.CustomLabels.Add(0.5, 1.5, "1"); serie1.Points.AddXY(2, 20000); serie1.Points.AddXY(3, 30000); serie1.Points.AddXY(4, 40000); serie1.Points.AddXY(5, 60000); serie1.Points.AddXY(6, 55000); serie1.Points.AddXY(7, 59000); serie1.Points.AddXY(8, 70000); serie1.Points.AddXY(9, 90000); serie1.Points.AddXY(10, 80000); area.AxisX.CustomLabels.Add(9, 11, "10"); serie1.Points.AddXY(11, 100000); serie1.Points.AddXY(12, 95000); serie1.Points.AddXY(13, 80000); serie1.Points.AddXY(14, 75000); serie1.Points.AddXY(15, 89000); serie1.Points.AddXY(16, 110000); serie1.Points.AddXY(17, 105000); serie1.Points.AddXY(18, 115000); serie1.Points.AddXY(19, 120000); serie1.Points.AddXY(20, 130000); area.AxisX.CustomLabels.Add(19, 21, "20"); serie1.Points.AddXY(21, 115000); serie1.Points.AddXY(22, 110000); serie1.Points.AddXY(23, 120000); serie1.Points.AddXY(24, 125000); serie1.Points.AddXY(25, 124000); serie1.Points.AddXY(26, 135000); serie1.Points.AddXY(27, 140000); serie1.Points.AddXY(28, 155000); area.AxisX.CustomLabels.Add(27, 29, "28"); serie1 is the blue line, area is the ChartArea. Anyone knows how I could make sure that the labels stay on the same row?
  3. D-Link have a very nice suport, FAQ and everything. I had a problemwith the rooter reeboting when downloading too much, they really helped me out and even proposed me to send it back to them for a new one... but my friend have a linksys wireless router and had... a VERY hard time seting it corectly... so you might just have been lucky enough to get the right compagny ^^.
  4. How big is the program, and does the error occur right as you loud (before any form shows up) or at any other time?
  5. I use firefox, because it's IMO the best option otu there, but I must say, there's no good browser out there, every browser have big security problems, and all browser have problems... FireFox download manager is really bad... But if you're really willing, you can re-write what you dont like about fireFox, wich you can't do with IE... And I havent checked al the extension yet, but this is also a + for FF A good browser need at least to be standards compliant, and that's why i'll never use IE again other than to make Windows update
  6. you're probably missing some code there... you have 2 catch for no try, and your GetInt(Arguments) is not even called inside any function/proc/method indent your code to see where { } begin and end, this should help you see where you missed something
  7. set your form size to the resolution of the screen (while having borderstyle=none)
  8. I still have only the record wich have presentations :/ I guess at this point i should do 2 query instead...
  9. no lets say my 3 tables have these: Publicity: ID name compId 1 a 1 2 b 1 3 c 1 4 omg 2 Compagny: ID Name 1 M$ 2 Apple Presentations PubID Time 1 2005/07/25 06:05:23 2 2005/07/25 07:05:23 2 2005/07/25 08:05:23 4 2005/07/25 09:05:23 1 2005/07/25 10:05:23 1 2005/07/26 06:05:23 I want my query to return me: Count(PubID) pub.name compagny.name 3 a M$ 2 b M$ 0 c M$ 1 omg Apple (I ommited certain collumn, but I'm pretty sure you now understand what I mean) I get these result just fine, if i dont put the date restrains. lets say I want publicity between 2005/07/25 07:05:22 and 2005/07/25 08:05:24 I should get: Count(PubID) pub.name compagny.name 0 a M$ 2 b M$ 0 c M$ 0 omg Apple but I only get: Count(PubID) pub.name compagny.name 2 b M$
  10. I dont remember wich option exactly needs to be set , but I know there's a property that makes the listboxes keep their data... look into the property box of your listboxes...
  11. Are you sure the DestPath exist? if not you need to create it first ... to do this: if(!Directory.Exist("D:\\destpath")) { Directory.Create("D:\\destpath")); } File.Copy(strPath,strdest);
  12. if the file a picture(since you said that you are displaying it in a picture box) and if so(stupid question) is it open by another app or in a share maybe? or... are you using winXp? I know it really have problem letting go of past used things... theye should be a way to destroy any link the OS have with any files... but M$ dont want that... I wouldnt care killing windows a couple of time if I could kill every process and delete any file I want when I want...
  13. Here's my problem I have a sql string sql="SELECT PubliciteArchive.ID, PubliciteArchive.Nom, PubliciteArchive.Type,PubliciteArchive.Duree,ClientArchive.Nom as Compagnie, Count(PresentationArchive.PubID) AS nbPres "+ "FROM PubliciteArchive, PresentationArchive, ClientArchive "+ "WHERE (((PubliciteArchive.ID)=[PubID] AND ClientArchive.ID=PubliciteArchive.ClientID) AND DatePResentation > #"+dtpDebut.Value+"# AND DatePresentation < #"+dtpFin.Value+"#) "+ "GROUP BY PubliciteArchive.ID, PubliciteArchive.Nom , PubliciteArchive.Type,PubliciteArchive.Duree,ClientArchive.Nom"; that is suposed to return me an ad with it's name, it's compagny name and the number of time it played between the dates that are in 2 DatePicker. The string return me the corect number of time and all the info I want, execpt that if there's no paying between the dates, instead of returning 0, it does not return a row. Is there a way to make it return a row with a 0 or should I create an ad class and store all the ad in an arrays of ads and then filter the dates?
  14. I love that Quote!
  15. This discussion come up every day at SlashDot, but I wanted to ask people who are using this forum what they think about it. To get the feel of developers like me who needs help sometime... Imagine a world where bubble sort is patented.... (not the best but probably the most used sort method due to it's simplicity[in beginers program anyway]) I am completly againts it, but maybe I should not count since I love Open source? Anyway what do you think about software patent?
  16. It should not be too hard to do, but you'll have to do it all from code, dont expect some miracle control... (doing it from code is more fun anyway :P) run trough your db and for every result, echo an <img src="imagename" alt="blabla" /> (i dont remember the code to do it, should be like something . Write) give them a class, and/or place them in div so you can place them like you want with Css
  17. Once again, I dont see the Edit button (does it diseapear after a while?) Anyway I found a way to do it! I fond some vb6 code on the web, wich I changed in vb.net, and it worked, but my program uses c# so I translated it to C#, but there is 1 problem (trhe last I hope) that make so it does not work... here's the solution in VB.NET Private Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" (ByVal hwndParent As Integer, ByVal fRequest As Integer, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Integer Private Const ODBC_ADD_SYS_DSN As Integer = 4 Public Function CreateSQLServerDSN(ByVal DSNName As String, ByVal ServerName As String, ByVal Database As String) As Boolean Dim sAttributes As String sAttributes = "DSN=" & DSNName & Chr(0) sAttributes = sAttributes & "Server=" & ServerName & Chr(0) sAttributes = sAttributes & "Database=" & Database & Chr(0) CreateSQLServerDSN = CreateDSN("SQL Server", sAttributes) End Function Public Function CreateAccessDSN(ByVal DSNName As String, ByVal DatabaseFullPath As String) As Boolean Dim sAttributes As String 'TEST TO SEE IF FILE EXISTS: YOU CAN 'REMOVE IF YOU DON'T WANT IT If Dir(DatabaseFullPath) = "" Then Exit Function sAttributes = "DSN=" & DSNName & Chr(0) sAttributes = sAttributes & "DBQ=" & DatabaseFullPath & Chr(0) CreateAccessDSN = CreateDSN("Microsoft Access Driver (*.mdb)", sAttributes) End Function Public Function CreateDSN(ByVal Driver As String, ByVal Attributes As String) As Boolean CreateDSN = SQLConfigDataSource(0&, ODBC_ADD_SYS_DSN, Driver, Attributes) End Function and the C# Version I came up with: [DllImport("ODBCCP32.Dll", SetLastError=true,CharSet=CharSet.Unicode, ExactSpelling=true, CallingConvention=CallingConvention.StdCall)] private static extern int SQLConfigDataSource(int hwndParent, int fRequest,string lpszDriver,string lpszAttributes); private const int ODBC_ADD_SYS_DSN=4; public static int CreateSQLServerDSN(string DSNName,string ServerName,string Database) { string sAttributes="DSN=" + DSNName + Convert.ToChar(0); sAttributes+="Server=" + ServerName + Convert.ToChar(0); sAttributes+="Database=" + Database + Convert.ToChar(0); return CreateDSN("SQL Server",sAttributes); } public static int CreateAccessDSN(string DSNName,string DatabaseFullPath) { int returnValue=0; string sAttributes; if(System.IO.File.Exists(DatabaseFullPath)) { sAttributes="DSN=" + DSNName + Convert.ToChar(0); sAttributes+="DBQ=" + DatabaseFullPath + Convert.ToChar(0); returnValue=CreateDSN("Microsoft Access Driver (*.mdb)", sAttributes); } return returnValue; } public static int CreateDSN(string Driver,string Attributes) { return SQLConfigDataSource(0,ODBC_ADD_SYS_DSN,Driver,Attributes); } the problem comes at the last line, and I suspect it actually comes from the Chr(0) to Convert.ToChar(0) translation, because in C# Attribues="DSN=100232\0DBQ=C:\\bd\\1002.mdb\0" and in vb.net is it: "DSN=100232 the fact that the string is unfinished tells me that i'ts probably multiline or something, and that the watcher just does not show the DBQ=C\bd\1002.mdb" that's what I guess anyway... so does anyone know what is the REAL remplacement for Chr(0) in C#, or does anyone see something else? PS:((I am really sorry for triple posting, but I assure you the edit button is not here :( )) ============================EDIT=========================== I fond Another way of doing it directly in C#, wich include playing directly with the registry, this: MSDN article helped me find a way to do it: private void CreerODBCAcessDSN(string dsnName,string dbq, string driver, string uID) { RegistryKey software = Registry.LocalMachine.OpenSubKey("Software",true); RegistryKey odbc=software.OpenSubKey("ODBC",true); RegistryKey odbcini=odbc.OpenSubKey("ODBC.INI",true); RegistryKey nwKey=odbcini.CreateSubKey(dsnName); nwKey.SetValue("DBQ",dbq); nwKey.SetValue("Driver",driver); //nwKey.SetValue("DriverId",driverId); nwKey.SetValue("FIL","MS Access;"); nwKey.SetValue("DriverId",0x00000019); nwKey.SetValue("SafeTransactions",0x00000000); nwKey.SetValue("UID",uID); RegistryKey engine=nwKey.CreateSubKey("Engines"); RegistryKey jet=engine.CreateSubKey("Jet"); jet.SetValue("ImplicitCommitSync",""); jet.SetValue("MaxBufferSize",0x00000800); jet.SetValue("PageTimeout",0x00000005); jet.SetValue("Threads",0x00000003); jet.SetValue("UserCommitSync","Yes"); jet.Close(); engine.Close(); nwKey.Close(); RegistryKey odbcdata = odbcini.OpenSubKey("ODBC Data Sources",true); odbcdata.SetValue(dsnName,"Microsoft Access Driver (*.mdb)"); odbcdata.Close(); odbcini.Close(); odbc.Close(); software.Close(); } WARNING:: I've only tested in on my computer, and some of the value I entered may or may not be system dependant... I sugest being carefull as it could hurt your registry. PS: before using this code, check an exemple of what is actually in the registry by making a false entry by the ODBC creating tool, and then check the resul with regedit
  18. I changed every Long to Integer and it worked, so you were right :)
  19. ok... vb is really not my favorite language, but I fond a code snipet on the web to create an odbc system dns... in VB so i tough I would at lest copy it to .net and try to make it work there before I try to change it to c#... what I tryed seems to compile but im really not sure about the first 3 lines... and it does not work so theres probably an error somewhere... original code as fond on http://home.pacbell.net/cetta/create-sys-DNS.htm Option Explicit Private Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" _ (ByVal hwndParent As Long, ByVal fRequest As Long, _ ByVal lpszDriver As String, ByVal lpszAttributes As String) _ As Long Private Const ODBC_ADD_SYS_DSN = 4 Public Function CreateSQLServerDSN(DSNName As String, _ ServerName As String, Database As String) As Boolean Dim sAttributes As String sAttributes = "DSN=" & DSNName & Chr(0) sAttributes = sAttributes & "Server=" & ServerName & Chr(0) sAttributes = sAttributes & "Database=" & Database & Chr(0) CreateSQLServerDSN = CreateDSN("SQL Server", sAttributes) End Function Public Function CreateAccessDSN(DSNName As String, _ DatabaseFullPath As String) As Boolean Dim sAttributes As String 'TEST TO SEE IF FILE EXISTS: YOU CAN 'REMOVE IF YOU DON'T WANT IT If Dir(DatabaseFullPath) = "" Then Exit Function sAttributes = "DSN=" & DSNName & Chr(0) sAttributes = sAttributes & "DBQ=" & DatabaseFullPath & Chr(0) CreateAccessDSN = CreateDSN("Microsoft Access Driver (*.mdb)", _ sAttributes) End Function Public Function CreateDSN(Driver As String, Attributes As _ String) As Boolean CreateDSN = SQLConfigDataSource(0&, ODBC_ADD_SYS_DSN, _ Driver, Attributes) End Function Same code, translated to vb.net... by me Private Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" (ByVal hwndParent As Long, ByVal fRequest As Long, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Long Private Const ODBC_ADD_SYS_DSN As Long = 4 Public Function CreateSQLServerDSN(ByVal DSNName As String, ByVal ServerName As String, ByVal Database As String) As Boolean Dim sAttributes As String sAttributes = "DSN=" & DSNName & Chr(0) sAttributes = sAttributes & "Server=" & ServerName & Chr(0) sAttributes = sAttributes & "Database=" & Database & Chr(0) CreateSQLServerDSN = CreateDSN("SQL Server", sAttributes) End Function Public Function CreateAccessDSN(ByVal DSNName As String, ByVal DatabaseFullPath As String) As Boolean Dim sAttributes As String 'TEST TO SEE IF FILE EXISTS: YOU CAN 'REMOVE IF YOU DON'T WANT IT If Dir(DatabaseFullPath) = "" Then Exit Function sAttributes = "DSN=" & DSNName & Chr(0) sAttributes = sAttributes & "DBQ=" & DatabaseFullPath & Chr(0) CreateAccessDSN = CreateDSN("Microsoft Access Driver (*.mdb)", sAttributes) End Function Public Function CreateDSN(ByVal Driver As String, ByVal Attributes As String) As Boolean CreateDSN = SQLConfigDataSource(0&, ODBC_ADD_SYS_DSN, Driver, Attributes) End Function As you can see I didnt change many thing... only the declare thing I tryed to ue it like this: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load CreateAccessDSN("100232", "C:\\bd\\1002.mdb") End Sub but the program throws an execption: An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication6.exe Additional information: Object reference not set to an instance of an object. now what I think is that I didnt translate it corectly, but if there's just anerror in the code, or if the problem is from the dll or anything like that, please tell me
  20. ((Sorry if I double post in that topic... but The Edit button is just not here)) It seems like nobody can help me, but just to make sure everyone understand what I mean I'll explain more clearly.... I want to register an ODBC connection to an Acess database so that I can use odbc_connect('name','',''); So my installation program should do this... now i'll ask to question, 1: do you understand what i'm talking about? 2: is it even possible? 3: any place I could look? Thank you
  21. I dont think it is possible to include a form inside another, but you can code something that check the locacation of the mother window on the child and ajust after
  22. sorry to bring back an old topic like that but.... C:\Documents and Settings\Nicolas Dufour\Mes documents\Visual Studio Projects\HoraireInstaller\Form1.cs(589): The type or namespace name 'FolderNameEditor' does not exist in the class or namespace 'System.Windows.Forms.Design' (are you missing an assembly reference?) I cant use the class... but i can run his exemple just fine, anyone can tell me what's wrong? maybe a part I didnt see? i re-wrote the code in c# by the way so I might have missed something... I included my code below so anyone chan chec what I did wrong... Edit: Ok I just fond out... and I feel dumb... System.Windows.Forms.FolderBrowserDialog so nevermind this
  23. I dont know how to do this. I want my program to copy an acess database to a folder, then create a DNS so that lets say... php can have acess to it. Is there a way to do this directly from C#?
×
×
  • Create New...