|
How can it be done? Do you know any site where i can find some information about this?
|
|
|
|
|
i want to know how can i convert my C# code into its corresponding assembly code for me to convert the assembly code into the corresponding .hex representation or convert it directly to hex ?
cause iam beginner to robotic field and i want to do that to use C# syntax and its OOP style in programming those chips and microcontrollers.
Any help regarding that.
By the way it is possible cause some companies already did that but for java coding style.
Mess With The Best And Die Like The Rest
|
|
|
|
|
If I understand what you want to do correctly you should prepare for bad news. C# doesn't compile to a native assembly language, it compiles to an intermediate form called MSIL. MSIL is JIT (just in time) compiled at runtime by the .NET CLR to native code, and this native code will only get generated if the CLR considers it safe.
All this makes C# an extremely bad choice for low level programming - you have no native code, and what you do have is useless without a .NET runtime for the platform you're running on.
I'd recommend a more traditional language like C++ for what you are trying to do.
Regards,
Rob Philpott.
|
|
|
|
|
Hi!
I know, When you read this subject you asked yourself "What the problem is this ?!"
Ok, I'm working on a Custom DateTimePicker in Shamsi Calendar User Control (for Iran) like .Net DateTimePicker Control. In first UserControl form i have just one ComboBox and on second form i have several objects.
But I cant change first forms ComboBox's Text from second form !!!
I changed it's Modifiers to public but also i can't access it.
Please Help me about multi page User Controls like this.
Thank You.
-- modified at 5:21 Wednesday 30th November, 2005
|
|
|
|
|
freshonline2003 wrote: I changed it's Modifiers to public but also i can't access it.
Really? Could you post some code that illustrates the problem?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hello Again
Dear S.Senthil Kumar
I started new Windows User Control project, I named that form to 'ucFirst'. I just added one ComboBox to it and change it's Modifier to public, then i added another User Control and named it 'ucSecond' and added several objects like panel and labels to it and changed Modifier property of them to public. Now i can access ucSecond's object from ucFirst as :
ucSecond copyucSecond = new ucSecond() ;
copyucSecond.Label1.Text = "something" ;
but i dont need this, Problem is I want to access ucFirst's ComboBox from ucSeond.
when i'm in ucSecond's code section and i want to type ucFirst i see in autocomplete there is no ucFirst and i have not access to ucFirst !!!
Ok, If you can Please help me about this.
So Thanks for your attention.;)
|
|
|
|
|
Hi Everybody,
While using the compute sum method of the Dataset, I'm getting an error like Invalid usage of aggregate function Sum() and Type: String. How to solve this. Pls help me whoever knows this problem.
Thanks
Raja Raman S
Reuters India Pvt.Ltd.
Bangalore
|
|
|
|
|
Hello raja_raman
It seems that you want to obtain a Single Value from a Database.
if your problem is this i use SqlCommand :
SqlCommand ordersCMD = new SqlCommand("SELECT Sum(orderprice) FROM Orders", nwindConn);
Int32 count = (Int32)ordersCMD.ExecuteScalar();
Maybe this solve your request, if not please mail me more about that.
I can help you.
Bye.
|
|
|
|
|
Hi,
Thank you very much for the mail. I'm sorry that I didn't make clear well about my query. I didn't want to obtain the value from Database. All the computed values which are stored in Database are displaying correctly. My problem is while computing that sum, I'm getting the error. Let me give you an example so as to make more clear.
Suppose I have a dataset called Ds1 which contains two fields, namely Country and No.of Women DegreeHolders. Say, for Eg. UK-50, US-40, Africa - 20, India - 80 etc. like that. Now If I try to take the sum of all Women Degreeholders of all the countries,say 190, it is giving error. I cannot take the sum from Database. I want take the sum from Dataset. Hope this is clear. Thanking you once again for your sincere help.
Raja Raman S
Reuters India Pvt.Ltd.
Bangalore
|
|
|
|
|
Hello Again !
I'm so sorry about my wrong reply about your problem.
I think now i know what is the problem, Please test below code for my second suggestion, may be it can usefull for you :
private void ComputeSumOfWomen(DataSet DS1)
{
DataTable copyTable;
copyTable = DS1.Tables["SampleTable"];
object objSum;
objSum = copyTable.Compute("Sum(noofwomen)", "country = Eng");
}
Compute takes two arguments, You can ignore second argument that is the condition of query and fill it blank like : "" , Again i hope this solves your problem.
And if you know about creating custom user controls, please read my problem with this subject : "Access Second User Control Forms Objects Properties"
Thank you very much.
|
|
|
|
|
hi,
i have to capture frames from a video in c#. for video capturing i am using code on
http://www.codeproject.com/cs/media/DirectShowMediaPlayer.asp
and cannot find code to capture frames from the video. how can i capture frames of video.
Regards
Nav
nav
|
|
|
|
|
The subject says it all,
the explicit typecast
string szMyString;
unsafe
{
char* szChars = (char*) szMyString;
SomeWin32DllFct(szChars);
}
will not compile. I need the string to be type casted as a char* so I can pass the content of the string as a parameter in a function imported from a win32 API.
Any idea?
-Sly
"there are 3 types of people in this world. There are those who understand binary, and those who don't."
|
|
|
|
|
nevermind, I found the answer to my own question.
Here it is:
using System.Runtime.InteropServices;
String l_szStringName = "I.C. Weiner";
// Convert string to char*
char* l_szCharName = (char*) Marshal.StringToHGlobalAuto(l_szStringName);
// Convert char* to String
string l_szMyString = Marshal.PtrToStringAnsi((IntPtr) l_szName);
-Sly
"there are 3 types of people in this world. There are those who understand binary, and those who don't."
|
|
|
|
|
Hi there,
i have a little problem with the looping can any one help to solve me this problem. the following are the code snippets.
objTempNodes = objXml.SelectNodes("//dc:relation/dcterms:isPartOf",objNameSpaceMgr);
sData[29] = "";
string relation_ispartof="";
string relation_ispartofURL="";
string relation_ispartofCol="";
foreach(XmlNode objNode in objTempNodes)
{
if (objNode.Attributes.Count == 0)
{
relation_ispartof=objNode.InnerText;
if (relation_ispartof.Trim()!="")
relation_ispartof = RemoveDups(relation_ispartof);
objNode.InnerText = relation_ispartof;
}
else
{
foreach(XmlAttribute ElementAttr in objNode.Attributes)
{
if (ElementAttr.Value=="dcterms:URL")
{
relation_ispartofURL=objNode.InnerText;
if (relation_ispartofURL.Trim()!="")
relation_ispartofURL = RemoveDups(relation_ispartofURL);
objNode.InnerText = relation_ispartofURL;
}
if (ElementAttr.Value=="nlbterms:Collections")
{
string strtmpCol="";
strtmpCol=objNode.InnerText;
int r = 0;
r=strtmpCol.IndexOf("~",0,strtmpCol.Length);
if (r!=-1)
{ string [] arrCollection = strtmpCol.Split("~",strtmpCol.Length);
string [] newarrCollect;
for (int collectCount=0;collectCount
|
|
|
|
|
Use the pre tag when pasting code so that the indentation is preserved, that will make the code readable.
---
b { font-weight: normal; }
|
|
|
|
|
if (ElementAttr.Value=="nlbterms:Collections")
{
string strtmpCol="";
strtmpCol=objNode.InnerText;
int r = 0;
r=strtmpCol.IndexOf("~",0,strtmpCol.Length);
if (r!=-1)
{ string [] arrCollection = strtmpCol.Split("~",strtmpCol.Length);
string [] newarrCollect;
for (int collectCount=0;collectCount {
string strArrCollection = arrCollection[collectCount];
if (newarrCollect.Length ==0)
{
newarrCollect.SetValue(strArrCollection,collectCount);
}
{
int r1 =0;
r1 = strtmpCol.IndexOf("~",0,strtmpCol.Length);
}
}
}
string [] arrCollection = strtmpCol.Split(new Char []{'~'},strtmpCol.Length);
string [] newarrCollect = RemoveDupsSp(arrCollection);
early it was using the below hardcode syntax which take only single value when i get value like 10100~10200 or 10100~10100 it cant able to display the data if we get value like 10100~10100 then it show display general same we we get value like 10100~10200~10400 then it show display general | Reference | Exclusive and if i get value like 10100~10100~10200 then it show display like general | referenc..etc
{
if (strtmpCol.Trim()=="10100")
relation_ispartofCol = "General";
if (strtmpCol.Trim()=="10200")
relation_ispartofCol = "Reference";
if (strtmpCol.Trim()=="10400")
relation_ispartofCol = "Exclusive";
//Final Storage of relation_ispartof
sData[29] = "Collection:" + relation_ispartofCol + "~URL:" + relation_ispartofURL + "~DOI " + relation_ispartof;
|
|
|
|
|
HELP REQD.
Trying to move from VB6 to C# (v2003) I made a MDI application which calls up Child forms from the main Menu of the MDI form. The menu Item is disabled when selected and the Child form shows up. It works fine till this point with the following code. mnuMHlagreement is the Name of the menu Item and frmLicence is the Child form.
private void mnuMHlagreement_Click(object sender, System.EventArgs e)
{
showForm(new frmLicence(), mnuMHlagreement);
}
private void showForm(Form formName, MenuItem menuName)
{
// Disable Menu Item
menuName.Enabled=false;
// Set the Parent Form of the Child window.
formName.MdiParent = this;
// Set Background Colour.
formName.BackColor = cFrmBClr;
// Display the new form.
formName.Show();
}
Now I want to enable the menu Item on the parent MDI form when the Child form is closed, which so far I have not been able to do. I am sure almost all of you out there know how it is done. So please let me know too.
Also in VB6 we could add Modules where all the Global declarations, etc. were made. In the above example cFrmBClr is a variable which holds the COlor selected at runtime from a ColorDialog on the MDI form. How do I make this a Global variable so that it can be accessed from any form.
I THANK YOU IN ANTICIPATION OF YOUR VALUABLE HELP.
BIK
|
|
|
|
|
If you want a parent form to do something based on the action of a child, the best way is to set up a delegate, so that a method in the main form gets called by your child form code, without the two being tightly coupled. 'delegate event C# site:msdn.microsoft.com' is the google string to get the info you need here.
us_bik wrote: How do I make this a Global variable so that it can be accessed from any form.
.NET, wisely, does not allow the hackery of global variables. If you need something to be visible, make it a static property on a class, then you can access it from anywhere with className.PropertyName.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi friends,
I am working on Web Application using C#. How can i send the post data(The data may have an object of a class) from one page to the next page.
I did't find in Request.Forword(), Server.Transfer() methods. In Java we
have RequestDispatcher class. Can i know what is the similar thing in C#.
If there is no class like this, please let me know the alternative solution.
I want, the end user should not get the URL/Query Parameters of the next page
in the Address Bar of his Browser.
Is it possible
Thanks,
Murthy.
-- modified at 23:28 Tuesday 29th November, 2005
|
|
|
|
|
|
Dear Ankit,
This is ok. But how can i send the post data to the other page at sever side.
And also receiving Post data in the Current Page.
I think Request.QueryString[....] does't help to us.
If my question is not clear, i will give you an example later.
Thanks,
Murthy.
|
|
|
|
|
Response.Redirect("/cldetail.aspx?bid=" + id + "&mail=" + email);
and cldetail page
public string clmail; //for taking emailid coming from status.aspx or link
public int id;
clmail=Request.QueryString["mail"].ToString();
id = int.Parse(Request.QueryString["bid"].ToString());
if am not understanding even now send me the example
see this example this may help u
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request
Dim Context As HttpContext = HttpContext.Current
Dim oldpath As String = Context.Request.Path.ToLower()
Dim lastpath() As String = Split(oldpath, "/")
Dim laname As String = lastpath.GetValue(lastpath.Length - 2)
Dim token As String = "/category/"
Dim i As Integer = oldpath.IndexOf(token)
Dim len As Integer = token.Length
If i <> -1 Then
Dim j As Integer = oldpath.IndexOf("/index.aspx")
If j <> -1 Then
Dim strName As String = oldpath.Substring(i + len, j - (i + len))
Dim id As Integer
id = database.getId(laname)
Dim navpath() As String = database.navigation(id)
Dim Newpath As String = oldpath.Replace(token & strName & "/index.aspx", "/user/home.aspx?action=1&cid=" & id)
Context.RewritePath(Newpath)
End If
End If
token = "-"
i = oldpath.IndexOf(token)
Dim proIndex As Integer = oldpath.IndexOf("/category")
len = token.Length
If i <> -1 Then
Dim j As Integer = oldpath.IndexOf(".aspx")
If j <> -1 Then
Dim strLid As String = oldpath.Substring(i + len, j - (i + len))
Dim strold As String = oldpath.Substring(proIndex, i - proIndex) & "-"
Dim NewLidpath As String
NewLidpath = oldpath.Replace(strold & strLid & ".aspx", "/user/moreinfo.aspx?lid=" & strLid)
Context.RewritePath(NewLidpath)
End If
End If
token = "/type/"
i = oldpath.IndexOf(token)
len = token.Length
If i <> -1 Then
Dim j As Integer = oldpath.IndexOf(".aspx")
If j <> -1 Then
Dim strName As String = oldpath.Substring(i + len, j - (i + len))
Dim typepath As String
typepath = oldpath.Replace(token & strName & ".aspx", "/user/type.aspx?ptype=" & strName)
Context.RewritePath(typepath)
End If
End If
End Sub
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
Hi Ankit,
This is my Example.
Consider an object of an Employee that have 200 or more
Data Members EmpNo, EmpName......
The Page1 (Employee Form) has 20 input fields.
Once the User filled the 20 input fields, I will send this object to the Business Component which is in the Business Logic.
After i processed this data object (i.e filling remaining
fields in the EmpObj using some logic), I will send back EmpObj to the same code behind of the Page1 from the Business Component.
Now, all the fields in the EmpObj has some data.
Next the end user should have a conformation page 'Page2' with some more additional readonly fields than Page1.
So what i want is, it is enough to send 'EmpObj' from Code Behind of
the Page1 to Page2 instead of sending
page2.aspx?EmpNo=1&EmpName=Murthy&CmpName=Symbiosys.... like that.
In the same way i have to catch the EmpObj in the Code Behind of the Page2 with 1-10 lines of code.
Please don't mine, i am asking like this. Because I am new in ASP.Net C#.
The above scenario is possible in Java by using RequestDispatcher class in servlet and
Employee empObj = (Employee) Request.getAttribute('EmpObj")
in JSP Pages.
Still if it is not clear, I will try to explain in some more detail.
Thanks and Best Wishes.
Murthy.
|
|
|
|
|
Server.Transfer method
End the current Web form and begin executing a new Web form. This method works only when navigating to a Web Forms page (.aspx).
Using the Transfer Method
Using the Transfer method is similar to executing a hyperlink or using the Redirect method, with one difference: Transfer can retain some information from the source page across requests. Setting the Transfer method’s preserveForm argument to True makes the form’s QueryString, ViewState, and event procedure information available in the destination form.
To be able to read one Web form’s ViewState from another, you must first set the EnableViewStateMac attribute in the Web form’s Page directive to False. By default, ASP.NET hashes ViewState information, and setting this attribute to False disables that hashing so that the information can be read on the subsequent Web form. The following line shows how to disable hashing so that a page’s ViewState can be used from another page:
Visual Basic .NET
<%@ Page language="vb" EnableViewStateMac="false"
Codebehind="RedirectNTransfer.aspx.vb"
Inherits="MCSDWebAppsVB.Transfer1" %>
Visual C#
<%@ Page language="c#" EnableViewStateMac="false"
Codebehind="RedirectNTransfer.aspx.cs" AutoEventWireup="false"
Inherits=" MCSDWebAppsVB.Transfer2" %>
The following event procedure for an ImageButton control shows how information can be passed between forms with the Transfer method:
Visual Basic .NET
' Transfer1.aspx
Private Sub imgTransfer_Click(ByVal sender As System.Object, _
ByVal e As System.Web.UI.ImageClickEventArgs) _
Handles imgTransfer.Click
' Transfer to another form, retaining ViewState.
Server.Transfer("Transfer2.aspx", True)
End Sub
Visual C#
// Transfer1.aspx
private void ImageButton1_Click(object sender,
System.Web.UI.ImageClickEventArgs e)
{
// Transfer to another form, retaining ViewState.
Server.Transfer("Transfer2.aspx", true);
}
WARNING
ASP.NET hashes ViewState information to prevent malicious users from manually changing the information passed back to the server and thus somehow corrupting data stored there. Disabling this hashing decreases the security of your Web application.
Use the Request object’s Form method to retrieve the ViewState information from the source Web form. The following code displays the values of two controls from the Transfer1.aspx Web form after the preceding Transfer method executes:
Visual Basic .NET
' Transfer2.aspx
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim colForm As _
System.Collections.Specialized.NameValueCollection
' Get data from source Web form.
colForm = Request.Form
' Display the value from Webform1's TextBox.
Response.Write("TextBox1.Text: " & _
colForm.Item("TextBox1") & " ")
' Display the x, y coordinates of where the click occurr ed.
Response.Write("ImageButton X, Y coords: " & _
colForm.Item("imgTransfer.x") & ", " & _
colForm.Item("imgTransfer.y") & " ")
End Sub
Visual C#
// Transfer2.aspx
private void Page_Load(object sender, System.EventArgs e )
{
System.Collections.Specialized.NameValueCollection c olForm;
// Get data from the source Web form.
colForm = Request.Form;
// Display the value from Webform1's TextBox.
Response.Write("TextBox1.Text: " + colForm["TextBox1"]
+ " ");
// Display the X, Y coordinated of where the click occurred.
Response.Write("ImageButton X, Y coords: " +
colForm["imgTransfer.x"] + ", " + colForm["imgTransfer.y"]
+ " ");
}
NOTE
The Server object’s Transfer and Execute methods work exclusively with Web forms. Trying to navigate to an HTML page using one of these methods results in a run-time error.
you can also store information in cookies
Well brother I am also new its a place to learn up together
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
I'm a member of a small (3 men) company, developing new .NET app "from garage". This app took over two years of development and now it's time to release it.
But the last question before releasing the final version is: Do we need more code protection?
How should the answer sound?
1) Yes - we have to buy some VERY EXPENSIVE code protector, like Xheo or Salamander. -gulp- But, we can't buy such a product without profit from the first release - a problem.
2) No - we can release all the MSIL code and don't care about "bad boys"
3) No - we can publish some source code (even if the application is commercial), either. There are still "good boys", which tell us, where are the security bugs in our code
Which answer is right?
|
|
|
|
|