|
Hi;
Plese let me know what basic things we have to install to run opengl example in c#.
I am using windowsXP sp2 and VisualStudio2008 and I included reference "csgl.dll" version 1.4.1.0
|
|
|
|
|
Hmm, OpenGL? How about an error?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
|
HI,
I am alok i made one windows project but in that project i want if normal user will login in menu strip options like account information or candidate information should hide but when adminstrator will login that time he\she should be able to go through all option hw to do that plz help me out.
|
|
|
|
|
if(
{
}
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
I hope that this[^] article can help you. Look at the section with:
System.Security.Principal.WindowsIdentity.GetCurrent()
|
|
|
|
|
Oh, didn't realize he was using built-in users...
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Hi Alok,
What I have done is in the formload event I put an IF statement that evaluates if it is the administrator that logged in. If it is not the Administrator then the buttons etc is to false.
if (tlstrlblUserName.Text != "administrator)
{
tlstrbtnExportData.Visible = false;
tlstrbtnUpdateDb.Visible = false;
toolStripSeparator7.Visible = false;
toolStripSeparator8.Visible = false;
So, if the user is not the administrator then the controls visibility is set to 'false'.
Hope this helps.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
lets make a variable int permision=0;
if user is admin make it 2
if user is local make it 1
the while formload check for the permission value
and use visible property of the menu i,e if is permission ==1 give visiblity =false
|
|
|
|
|
Dear All
If anyone can provide me the example or url for updating the SQL table from DataGridView i have googled it but not able to found the required example
Thanks
|
|
|
|
|
Hi,
i have a treeView,Load Button,listbox and textbox on my winform.
i want that wen a user loads a XML file it should be shown as TreeView on my winform.
Then wen a node is selected in the treeview its attributes should be displayed in the listbox and values in Textbox.
i have written a part of code which shows all the attributes at once in the listbox on loading the XML file.As i am new to C# i dont know what to write in AfterSelect().The code is here
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Xml;
using System.Text;
using System.Windows.Forms;
namespace LoadXMLtreeDisplay
{
public partial class TreeDisplay : Form
{
TreeView listViewobj = new TreeView();
XmlDocument xdoc = new XmlDocument();
public TreeDisplay( )
{
InitializeComponent();
this.Controls.Add(treeViewObj);
this.listBoxshow.SelectedIndexChanged += new System.EventHandler(this.listBoxshow_SelectedIndexChanged);
}
private void treeDocLoadMethod(string nameofFile)
{
try
{
txtBoxfile.Text = nameofFile;
xdoc.Load(nameofFile);
this.treeViewObj.Nodes.Clear();
this.treeViewObj.Nodes.Add(new TreeNode(xdoc.DocumentElement.Name));
TreeNode tNodeObj = new TreeNode();
tNodeObj = this.treeViewObj.Nodes[0];
XmlNodeList nodeList = xdoc.SelectNodes("//settings/tables/table/name[. ='{0}']");
XmlNode xNode = xdoc.DocumentElement;
ConvertAllXmlnodetoTreenode(xdoc, treeViewObj.Nodes);
treeViewObj.Nodes[0].Expand();
treeViewObj.CollapseAll();
Cursor = System.Windows.Forms.Cursors.Default;
}
catch (XmlException xmlex)
{
MessageBox.Show(xmlex.Message, "ERROR");
}
catch(Exception exp)
{
txtBoxfile.Text = exp.Message;
}
}
private void ConvertAllXmlnodetoTreenode(XmlNode xmlNode, TreeNodeCollection treeNodeCollection)
{
TreeNode treeNodeobj = treeNodeCollection.Add(xmlNode.Name);
switch (xmlNode.NodeType)
{
case XmlNodeType.ProcessingInstruction:
case XmlNodeType.XmlDeclaration:
treeNodeobj.Text = "";
break;
case XmlNodeType.Element:
treeNodeobj.Text = "<" + xmlNode.Name + ">";
break;
case XmlNodeType.Attribute:
treeNodeobj.Text = "ATTRIBUTE: " + xmlNode.Name;
listBoxshow.Items.Add(treeNodeobj.Text);
break;
case XmlNodeType.Text:
case XmlNodeType.CDATA:
treeNodeobj.Text = xmlNode.Value;
listBoxshow.Items.Add(treeNodeobj.Text);
break;
case XmlNodeType.Comment:
treeNodeobj.Text = "<!--" + xmlNode.Value + "-->";
break;
}
if (xmlNode.Attributes != null)
{
foreach (XmlAttribute attribute in xmlNode.Attributes)
{
ConvertAllXmlnodetoTreenode(attribute, treeNodeobj.Nodes);
}
}
foreach (XmlNode childNode in xmlNode.ChildNodes)
{
ConvertAllXmlnodetoTreenode(childNode, treeNodeobj.Nodes);
}
}
private void ConvertAddTreeNodestoTree(XmlNode xnode, TreeNode tnode)
{
XmlNode xNode;
TreeNode treeNode;
XmlNodeList nodeList;
if (xnode.HasChildNodes)
{
nodeList = xnode.ChildNodes;
for (int i = 0; i <= nodeList.Count-1;i++)
{
xNode = xnode.ChildNodes[i];
tnode.Nodes.Add(new TreeNode(xNode.Name));
treeNode = tnode.Nodes[i];
ConvertAllXmlnodetoTreenode(xNode,treeNode.Nodes);
}
}
else
{
tnode.Text = xnode.OuterXml.Trim();
}
}
private void ExpandBtn_Click(object sender, EventArgs e)
{
try
{
if (this.ExpandBtn.Text == "Expand TreeNodes")
{
this.treeViewObj.ExpandAll();
this.ExpandBtn.Text = "Collapse TreeNodes";
}
else
{
this.treeViewObj.CollapseAll();
this.ExpandBtn.Text = "Expand TreeNodes";
}
}
catch(Exception exp)
{
MessageBox.Show(exp.Message,"Error");
}
}
private void btnBrowse_Click(object sender, EventArgs e)
{
txtBoxfile.Clear();
listBoxshow.Items.Clear();
listBoxeg.Items.Clear();
ExpandBtn.Text = "Expand TreeNodes";
OpenFileDialog open = new OpenFileDialog();
open.Filter = "XML Files(*.xml)|(*.xhtml)|All files(*.*)|*.*";
open.FilterIndex = 2;
open.RestoreDirectory = true;
if (open.ShowDialog(this)== DialogResult.OK)
{
txtBoxfile.Text = open.FileName;
treeDocLoadMethod(open.FileName);
}
}
private void treeViewObj_AfterSelect(object sender, TreeViewEventArgs e)
{
listBoxeg.Items.Clear();
XmlNode xNode = xdoc.DocumentElement;
TreeNode selNode = e.Node;
textBox1.Text = selNode.Text;
if (e.Node.TreeView.SelectedNode != null)
{
foreach (XmlAttribute attribute in xNode.Attributes)
{
ShowinListboxandTextbox(attribute, selNode.Nodes);
selNode.Text = "ATTRIBUTE: " + xNode.Name;
listBoxeg.Items.Add(selNode.Text);
}
}
}
private void ShowinListboxandTextbox(XmlNode xmlNode,TreeNodeCollection treeNodecollect)
{
TreeNode treeNodeobj = treeNodecollect.Add(xmlNode.Name);
switch (xmlNode.NodeType)
{
case XmlNodeType.Attribute:
treeNodeobj.Text = "ATTRIBUTE: " + xmlNode.Name;
listBoxeg.Items.Add(treeNodeobj.Text);
break;
case XmlNodeType.CDATA:
treeNodeobj.Text = xmlNode.Value;
listBoxeg.Items.Add(treeNodeobj.Text);
break;
}
}
}
}
This is not showing the desired result as i want if anyone can provide the correct part of code required i will be thankful.
modified on Monday, February 23, 2009 1:36 PM
|
|
|
|
|
Hi All,
I am creating a C# Dll that is invoked by an external application (3rd Party application) and want to Debug my class libray (by setting breakpoints) when it is invoked.
My scenario is:
- External application is running and it triggers my DLL and automatically calls a specific DLL function.
- C# Class Library (dll) is part of a VS2008.NET solution and can be Invoked from External Application:
1. If I Attach it to my "External application process" using "Attach to Process" option.
In this case, I am unable to set the breakpoints as it says "Symbols Not loaded" and when i check in Debug->Modules window, I do not see my .dll loaded.
2. If I add a Windows application project and then "Run" my solution. ("Windows Application" as "Startup Project" and creating an instance of my Class Library in it)
In this case, I can set the breakpoints, but when the function is Invoked by "External Application" it does not stop at the breakpoint.
Can anyone please advice as to how I can debug my Class Library when it is invoked by an external application (unmanaged code)?
Please note, I have set the build and debug configuraion of my class library project to "Debug".
Sample Code (if it helps to understand more clearly):
Class Library
-------------
namespace Sample
{
public class SampleClass
{
public bool SampleFunction(CustomClass vt)
{
MessageBox.Show("Hello!");
return true;
}
}
}
My External application, invokes method "SampleFunction" automatically on a certain event and passes CustomClass object in it.
Thanks,
|
|
|
|
|
This is a good question. I my self have trouble debugging my threaded application. I wrote a small logging routine that helped me solve my problems.
This is probably not the answer you were looking for, but I haven't found any other good solution to the problem. If you find one, I'd be glad to know.
|
|
|
|
|
Hi friends,
Is there any way to compare two speeches(Audio) in c#. I am not saying text to speech. Its comparing two speeches.
Regards,
Rahul
|
|
|
|
|
No - you need to build or write a library for that.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello,
I have a raw data which has width of 1500 and height of 1000 resolution 300dpi, I want to convert this data in jpeg format.. how do I go about doing it?
Please help me with this asap.
Thank you.
|
|
|
|
|
Create a Bitmap object from the data (there is a constructor that takes a pointer to raw data), and save it to a file as a JPEG image.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
X is a float and I need to perform x/10 and round the result up to the integer. So if result is 0.4 -> 1, if 1.1 -> 2, 2.7 -> 3. How can I do this in C#?
|
|
|
|
|
|
Math.Ceiling()
Cheers,
Vıkram.
I've never ever worked anywhere where there has not been someone who given the choice I would not work with again. It's a job, you do your work, put up with the people you don't like, accept there are probably people there that don't like you a lot, and look forward to the weekends.
- Josh Gray.
|
|
|
|
|
in order to prevent memory leaks can i force GC to collect memory which are having references.
|
|
|
|
|
yes, we can force GC by the following function.
GC.Collect()
|
|
|
|
|
ok, but this collects only the memory which are not having references , isn't it , what i want to know is , if there any method which i can use to get collected by GC when i give the name of the object even though it is having references
|
|
|
|
|
prasadbuddhika wrote: if there any method which i can use to get collected by GC when i give the name of the object even though it is having references
Why would you want to do that? What if the object gets GCed and then a method gets called on that object by one of the other references?
If you know the object is not going to be used further, call its Dispose() method, assuming it has one, or at least set the references to null so the GC can collect it.
Cheers,
Vıkram.
I've never ever worked anywhere where there has not been someone who given the choice I would not work with again. It's a job, you do your work, put up with the people you don't like, accept there are probably people there that don't like you a lot, and look forward to the weekends.
- Josh Gray.
|
|
|
|
|
why don't you just make your program crash the traditional ways instead of trying to invent a new one ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|