|
|
Adam, last question. The exmple you provided, is that for using with SQL or with XML? I'm a bit lost at which base to use for storing the information in.
|
|
|
|
|
That was for C#, which i am assuming you are writing your GUI in. The code was just a logic loop so it will only post your reminder once.
I don't personally know XML, but SQL is a great program to store information. There's an excellent article on here about SQL by Matt Newman, it might be useful for your project.
http://www.codeproject.com/cs/database/sql_in_csharp.asp
Oh, and the "data and time" in there would be a string in your app... if your using SQL you may have to use the .TrimEnd( ) Command to get rid of extra spaces at the end of the saved "date and time" to make it work right as SQL fills any un-used room with spaces for you.
I hope that answered your question, if not just message back.
Adam
--Its not broken if it never worked.
|
|
|
|
|
I have created a DLL called uptimelib.dll, which
has one function:
public static string GetUptime()
{
double secs, mins, hours, days, hours2, mins2, secs2;
double ticks = Environment.TickCount;
secs = Math.Floor(ticks / 1000);
mins = Math.Floor(secs / 60);
hours = Math.Floor(mins / 60);
days = Math.Floor(hours / 24);
hours2 = hours - (days * 24);
mins2 = mins - (hours * 60);
secs2 = secs - (mins * 60);
return days + "days, " + hours2 + "hours, " + mins2 + "minutes, " + secs2 + "seconds";
}
The problem is, I want to be able to use this function in other projects, just by importing the dll using DllImport(). Therefore, I have put uptimelib.dll in System32 folder, and imported it into my project:
[DllImport("uptimelib.dll")]
public static extern string GetUptime();
But whenever I try to use the function, it throws an exception saying "Uptimelib.dll does not contain an entry point named GetUptime()". I have checked that everything is spelled correctly, and so on.
How do I fix it?
Thanks in advance.
-- modified at 14:18 Wednesday 3rd October, 2007
Virtual1ty
"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
Incase you didn't know, you can also just add a reference to the DLL, so you don't need to use DLLImport. Then you use the function as though it was with the rest of your source code.
To add a reference, right click the folder 'references' in you project view-thing and click add reference, look for a button that says browse or similar. I use sharpdevelop so if your using something else, its probably slighty different.
As for using DLLImport on your own dll's i have no idea, sorry.
|
|
|
|
|
Yes, I knew that, but I still want this to work as well.
Virtual1ty
"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
Hello,
I am having an issue with the datagridview in C#. I have set-up the data grid view table, and am trying to set the Selected Item in a "DataGridViewComboBoxColumn" cell. I need to be able to set the selected Item manually as part of a load command (Which retreives information from a remote server). The Items list is populated from a Data Source, which works.
I can load the information into a "DataGridViewTextBoxColumn" cell but not a "DataGridViewComboBoxColumn " cell.
Does anyone know how to set the Selected Item in a DataGridViewComboBoxColumn cell?
Any thoughts would be appreciated.
Thanks,
Adam
-- modified at 13:56 Wednesday 3rd October, 2007
|
|
|
|
|
Hello,
So, I've got a DataGridView that is bound to some data in a DataTable. I only show a subset of the columns and additionally have two non-bound columns in the DataGridView.
I've attempted to set the column ordering via the DisplayIndex property to no avail.
If I attempt to set the DisplayIndex for each in ascending order such as:
column0.DisplayIndex = 0;
column1.DisplayIndex = 1;
.
.
.
column9.DisplayIndex = 9;
the columns don't order correctly. They end up showing up as follows (numbers are the order that I specified them in):
0, 1, 2, 6, 8, 4, 7, 3, 9, 5
The two non-bound columns are 6 and 8 and are DataGridViewImagaColumns. The others are text columns.
Has anyone else had such a problem and solved it? I saw some similar questions asked in my google searching but didn't see a solution to this. I wonder if it is a bug or perhaps I'm just missing something here.
Thanks for you help,
Matt
TODO: Think up something witty to put here.
|
|
|
|
|
Hey,
I don't know if there is a reason your changing the order via the DisplayIndex, or what your using to write your code, but if you right click on the datagridview and go edit columns, then you can change the order by moving them up and down in the list(In Visual Studio .NET 2005).
Hope that helps, if not disregard.
|
|
|
|
|
I am using SQL Server 2005, C#.net 2005, I'm new at this and can't figure out or find information on how to delete a record.
bluegrassman
|
|
|
|
|
Problem
Problem is about resizing of controls on the similar project disussed above if i place a group box on the child form and put some controls when i run it the controls are adjusted as i placed and there is lot of space empty on the child form how should it be done that when i open the child form the control should be resized according to the maximize button and according to the size of the parent
SAS
sas
|
|
|
|
|
Hello all ,
C# 2005
Hardware Pic18F4550 Usb controller working as an HID device
Usb device with Bootloader and main software.
VID & PID are not change.
problem :
each time that I update the soft of my USB device ,I need to unplug - plug de device manually so it can work after.
idea:
CyclePort (disconnect & reconnect) via software my device after
an update.
I have also find info on re-enumerate device but not certain on that.
Solution:
?????
thank you in advance for your help
Etao
|
|
|
|
|
have you looked at this? http://www.icsharpcode.net/opensource/sharpusblib/
VirtualVoid.NET
|
|
|
|
|
Hello,
I'm programming a little music helper and use the System.Drawing class, to draw the staves and notes on a PictureBox. I want to save that as Image, but all my attempts failed. Of course I used Google to find the answer and I found a advice. It says that I have to draw my things on a Bitmap first and save that. But How do I draw something on a Bitmap with Graphics?
I'm looking forward to your answers.
Best regards
MyPiano(Joris)
edit: Sorry for my English. It isn't my mother-tongue.
|
|
|
|
|
Drawing anything in a Bitmap using a Graphics object is very easy. You will need to first create one bitmap object and use it for initializing graphics object.
Once you get one graphics object created using FromImage method, you may draw anything in this graphics object and it will be drawn on bitmap also.
At last you may save the bitmap using Save method of bitmap object.
Such as-
----------Start Code----------------
Bitmap a = new Bitmap(400, 300);
Graphics g = Graphics.FromImage(a);
g.DrawLine(Pens.AliceBlue, 0, 0, 100, 100);
a.Save(“C:\MyFile.jpg”);
--------------End Code--------------
I hope this helps .
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Hey Dave,
Thanks for your help. It works great now!
Best regards
Joris
|
|
|
|
|
Hi which is the default script used in dot net?
|
|
|
|
|
If you mean to ask which is the default development language in .NET, then there isn't one. Out of the box, you can develop in C# or VB.NET (the compilers are included with the .NET runtime) and you can download/choose other languages as you see fit.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
What do you mean? Please make it clear.
Do you mean scripting language by any chance?
---------------------------------------------------------------------
"The only true wisdom is in knowing you know nothing." -- Socrates
|
|
|
|
|
could you kindly clearly inform ur questions ??
or r u looking for scripting langauge in asp.net???
Thanks
Happy Programming
-----
Abhijit
|
|
|
|
|
<?xml version="1.0" standalone="yes"?>
<passwd>
<principal name="ADM" class="Class value" password="+100-70-44+41-220-96-42+100-70+114+163-3-27+33+142+72">
<grant name="store.all.admin" />
<grant name="launch.more" />
<grant name="launch.all" />
<grant name="user-management" />
<grant name="Direction" />
</principal>
<principal name="Archive" class="Class value" password="+100-70-44+41-220-96-42+100-70+114+163-3-27+33+142+73">
<grant name="Archive" />
</principal>
<principal name="Michael" class="Class value" password="+100-70-44+41-220-96-42+100-70+114+163-3-27+33+142+74">
<grant name="launch.all" />
<grant name="launch.more" />
<grant name="Michael" />
</principal>
<principal name="admin" class="Class value" password="+100-70-44+41-220-96-42+100-70+114+163-3-27+33+142+75">
<grant name="store.all.admin" />
<grant name="launch.more" />
<grant name="launch.all" />
<grant name="user-management" />
</principal>
<grant name="Direction" codebase="file:./jars/r/*">
<permission name="Direccao" class="openwfe.org.worklist.auth.StorePermission" rights="read, write, delegate" />
</grant>
<grant name="Archive" codebase="file:./jars/r/*">
<permission name="Archive" class="openwfe.org.worklist.auth.StorePermission" rights="read, write, delegate" />
</grant>
<grant name="Michael" codebase="file:./jars/r/*">
<permission name="Michael" class="openwfe.org.worklist.auth.StorePermission" rights="read, write, delegate" />
</grant>
<grant name="store.all.admin" codebase="file:./jars/r/*">
<permission name="Store.*" class="openwfe.org.worklist.auth.StorePermission" rights="read, write, delegate" />
</grant>
<grant name="launch.more" codebase="file:./jars/r/*">
<permission name="mainEngine::http://localhost:7080/flow-index.jsp" class="openwfe.org.worklist.auth.LaunchPermission" />
</grant>
<grant name="launch.all" codebase="file:./jars/r/*">
<permission name=".*::http://localhost:.*" class="openwfe.org.worklist.auth.LaunchPermission" />
</grant>
<grant name="user-management" codebase="file:./jars/r/*">
<permission name="passwd" class="openwfe.org.auth.UmanPermission" rights="manage" />
</grant>
</passwd>
EDIT: the XML isn't showing (download here: http://rapidshare.com/files/59995138/test.xml.html)
I have this XML.
I use the code below to open the XML and treat it as a DataSet and view it in a datagrid.
<code> try
{
dataset = ReadXML(szPassword);
dataGrid1.DataSource = dataset;
dataGrid1.DataMember = "principal";
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}</code>
put this in a different class, if you wish.
<code> public DataSet ReadXML(string szMyXMLfile)
{
DataSet ds = new DataSet();
try
{
ds.ReadXml(szMyXMLfile);
return ds;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}</code>
I want to treat The DataSet, NOT the XML, (change values, modify fields) through code.
How Can I get these fields from the dataset's ADM name into an ArrayList? (look at picture) http://bayimg.com/eaHdKAaBg
<code>store.all.admin
launch.more
launch.all
user-management
Direction</code>
Thanks for your replies.
EDiT: here's my current search routine
<code>
foreach(DataRow dr in dataset.Tables["principal"].Rows)
{
if (dr["name"].ToString()=="ADM") // "ADM" (for example)
{
foreach(DataRow dr2 in dataset.Tables["grant"].Rows)
{
textBox1.Text += dr2["name"].ToString() + Environment.NewLine;
aPermissoes.Add(dr2["name"].ToString());
}
if (textBox1.Text.Length>=2) textBox1.Text = textBox1.Text.Remove(textBox1.Text.Length-2,2);
}
}
</code>
-- modified at 12:42 Wednesday 3rd October, 2007
|
|
|
|
|
What XML? I don't see anything.
Paul Marfleet
|
|
|
|
|
I edited my post. I don't know how to make the xml visible in the code. there is a download link.
Thanks for the reply.
|
|
|
|
|
Check the little box next to "Ignore HTML tags in this message..." before you hit "Post Message".
You can go back and edit your message to turn this option on.
|
|
|
|
|
Found a solution
<br />
int nPrincipal_Id = 0;<br />
foreach (DataRow myRow in dataset.Tables["principal"].Rows)<br />
{<br />
if (myRow["name"].ToString()==textBox2.Text)<br />
{<br />
nPrincipal_Id = Convert.ToInt32(myRow["principal_Id"].ToString());<br />
}<br />
}<br />
<br />
foreach (DataRow myRow in dataset.Tables["grant"].Rows)<br />
{<br />
if (myRow["principal_Id"].ToString() == nPrincipal_Id.ToString())<br />
textBox1.Text += myRow["name"].ToString() + Environment.NewLine;<br />
}
|
|
|
|