|
well the code I posted is in a file called DataAccessSelectClass.cs (and its called from a webform1.aspx.cs page)
the code inside the method is just temporary - once I figure out how to call it, the code will be changed to return a dataset.
|
|
|
|
|
digsy_ wrote: namespace aspnetcsharpdemo
{
///
/// Summary description for Class1.
///
public class Class1
What the file is called does not matter. This class is called Class1, or aspnetcsharpdemo.Class1. You're looking for a different class, with a method called Class11 ?? Or is Class11 a class in a namespace called DataAccessSelectClass and your code is totally confused ?
Use real class names, not class1 or class11.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
As Christina said, the file name is irrelevant.
To access the method in the class you use:
Label1.Text = aspnetcsharpdemo.Class1.Class11();
If you would have named your class DataAccessSelectClass instead of Class1, you would use:
Label1.Text = aspnetcsharpdemo.DataAccessSelectClass.Class11();
And if you had using aspnetcsharpdemo; at the top of your page, or if your page class was inside namespace aspnetcsharpdemo , you could use:
Label1.Text = DataAccessSelectClass.Class11();
---
b { font-weight: normal; }
|
|
|
|
|
use this
Label1.Text = aspnetcsharpdemo.Class11();
sAqIb
|
|
|
|
|
sorry for the mistake
use this
Label1.Text = aspnetcsharpdemo.Class1.Class11();
means, namespacename.classname.function_name_of_class();
it will work
sAqIb
|
|
|
|
|
sorry for the mistake
use this
Label1.Text = aspnetcsharpdemo.Class1.Class11();
means, namespacename.classname.function_name_of_class();
it will work
sAqIb
|
|
|
|
|
I've written a code that creates a receives the request, sent by the web browser(I use FireFox), and then it parses the request and set the headers of a WebRequest object and if it finds any information after the empty line, it writes the information in the WebRequest object, then I get a WebResponse object out of the WebRequest object and creates 2 byte arrays, then it reads the WebResponse stream and puts the data in the first byte array and then puts the Header information of the WebResponse in the second array using the ToByteArray method of the WebResponse's Header propety.
Then I have tried to methods for sending data to the web browser:
1)I have sent the Header array first in a separated Send method and then the Data array in a separated Send method after that, that makes the browser report the "Done" status and shows nothing!
2)I have added the data to the end of the header and sent them az a single Send method, that makes the browser show the html and css and jscript information but it leaves the places of the pictures empty!
Does anyone know, what should I do to fix this problem?
Should I send the header just if the data is in html/text format?
Or the Gip/Png/Jpg of Application data formats also need the header?
If they need, how to make the browser show the images and flashes?
Please help!
Sojaner!
|
|
|
|
|
Hi,
How can i 'see' what check box(es) are selected in an if statement?
This is how i want it:
if(chkbx1.checked == true AndOr chkbx2.checked == true ....... AndOr chkbx10.checked == true)
Thanks in advance!
|
|
|
|
|
What is the AndOr operator supposed to do? The C# or operator || is non exclusive, which means that it's result is true if either operand is true or both operands are true.
|
|
|
|
|
Hi,
I want to check if non is selected or 1 or more.
Depending on which chkboxes are selected, its suppose to do something with all the code "behind" the selected boxes.
So || is what i need ha.
Ima try that.
Do you also happened to know how i can merge 2 .txt files into a new file?
Thanks in advance!
|
|
|
|
|
The shortest way:
string file1 = File.ReadAllText("file1.txt");
string file2 = File.ReadAllText("file2.txt");
File.WriteAllText("file3.txt", file1 + file2);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi Greeeg,
Thanks for your reply,
I meant in a new file.
So if i understand the way you did it. Than this is how it would be done to a new file (please do correct me if i'am wrong):
string file1 = File.ReadAllText("file1.txt");
string file2 = File.ReadAllText("file2.txt");
StreamWriter file3 = new StreamWriter("file3.txt", true);
file1.Write(file3);
file2.Write(file3);
|
|
|
|
|
See my previous post. I made a mistake and rewrote it
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
Hi,
Is there a way that I can programmatically resize the columns of a listview in report mode so all the text in the columns is visible when it comes up?
thanx
|
|
|
|
|
Hi!
Yes, you can set the column header's width to -1 or -2 so that it'll adjust to the maximum item width or the column heading width resp.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
|
how can i refresh SQLserver tables from C# using ado.net classes
|
|
|
|
|
Can you explain in more detail what you are trying to do?
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
hey guys
I am tring to implement a filter in a datagrid. I am using a datatable
which is the datasource for the grid.
I need to filter set of rows. i.e. from row 1 to row count. i need to
keep my row 0 intact, which is an option to add a new person.
textbox key up code looks like this:
string strRowFilter = String.Concat("Name LIKE '%", txtName.Text,
"%'");
dv.RowFilter = strRowFilter;
grdNames.DataSource = dv;
plz help
sunny
|
|
|
|
|
I've been given the task of upgrading an old VB6 application to C#, and I think I'm starting to go down for the third time.... (and yes I've been reading miriads of posts, but not getting it).
The old application used a dll which still needs to be called in the new c# application.
In the vb6 code, the dll function needed was declared like this:
Declare Sub neededFunciton Lib "UnmanagedDLL.dll" (ByRef nestedStruc As NESTED_STRUC_TYPE)
where....
Public Type NESTED_STRUC_TYPE
iNum1 As Long
fNum2(coniMaxSize) As Single
nextNestedStruc As NEXT_NESTED_STRUC_TYPE .
End Type
Public Type NEXT_NESTED_STRUC_TYPE
iAnotherNum1 As Long
fAnotherNum2(coniMaxSize) As Single
THIRDNestedStruc As THIRD_NESTED_STRUC_TYPE
End Type
Public Type THIRD_NESTED_STRUC_TYPE
fArray1(coniMaxSize) As Single
fArray2(coniMaxSize) As Single
fArray3(coniMaxSize) As Single
fArray4(coniMaxSize) As Single
End Type
Public Const coniMaxSize As Integer = 144
In C#, I created a class BigObject containing all that struct stuff and the declarations:
[DllImport(@"C:\WINDOWS\UnmanagedDLL.dll", EntryPoint = "NeededFunciton")]
internal static extern int neededFunciton(ref NESTED_STRUC_TYPE nestedStruc);
After reading some examples I included this:
[DllImport("kernel32.dll", SetLastError=true)]
public static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool FreeLibrary(IntPtr hModule);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate BigObject MyDelegate(ref BigObject.NESTED_STRUC_TYPE nestedStruc);
internal int NeededFunciton(ref NESTED_STRUC_TYPE nestedStruc)
{
IntPtr pDll = LoadLibrary(@"C:\WINDOWS\UnmanagedDLL.dll");
if (pDll != IntPtr.Zero)
{
IntPtr pAddressOfFunctionToCall = GetProcAddress(pDll, "NeededFunciton");
if (pAddressOfFunctionToCall != IntPtr.Zero)
{
MyDelegate myDelegate = (MyDelegate)Marshal.GetDelegateForFunctionPointer(
pAddressOfFunctionToCall,
typeof(MyDelegate));
try
{
myDelegate(ref nestedStruc);
}
catch (Exception e)
{
}
}
}
return Convert.ToInt16 (FreeLibrary(pDll));
}
Finally, in another class, I try to call the NeededFunciton with the nestedStruc which has been prepopulated with data:
bigObject.NeededFunciton(ref nestedStruc);
I'm getting
FatalExecutionEngineError was detected
Message: The runtime has encountered a fatal error.
The address of the error was at 0x79f1c184, on thread 0x970. The error code is 0xc0000005.
This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code.
Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
OK, with all those nested strucs, I'm guessing I'm getting marshaling errors.
Can someone shoot me to a good site ref. or add a bit of insight that might kick start me again?
I'm afraid I have chronic brain cramp....
|
|
|
|
|
cpshadle wrote: good site ref
http://www.codeproject.com[^]
(Sorry, that was a bit harsh. Sorry I can't help at the moment but I'll take a look through when I get the chance).
|
|
|
|
|
|
If I create a Generic Dictionary<K,V> collection object and use my own custom class as the Key, do I have to override the Equals(object o) and GetHashCode() methods for my custom class?
I know I have to do this if I use the non-generic version of Dictionary, the HashTable class, according to MSDN documentation anyway, but I can't find anything about how this rule applies to the Generic Dictionary<K,V> collection type. I'm assuming not, but then how does the Dictionary hash the key internally?
Cheers!
Sunday Ironfoot
|
|
|
|
|
Never had to in my cases.
|
|
|
|