|
Easy. A client-side Java Script component. The code that shows the machine details is running in the BROWSER, not on the server side.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I have a problem to understand a pointer thing under .NET:
I have built an unsafe class in which I access the bits of a bitmap using a rgb-struct-pointer:
(RGBTRIPLE*)(ptBits + iY * iPitch + iX * sizeof(RGBTRIPLE));
with
[StructLayout(LayoutKind.Sequential)]<br />
public struct RGBTRIPLE <br />
{ <br />
public byte rgbtBlue;<br />
public byte rgbtGreen;<br />
public byte rgbtRed;<br />
}
It works well with both a locked System.Drawing.Bitmap, and an image, which I loaded externally using "FreeImage.dll".
So for my understanding I have the same image data structure in memory: the locked GDI+ Bitmap and the FreeImage-bitmap and in both cases I have got a pointer that points to the structure start and in both cases I use the same 24bit-struct to access the pixels.
But nevertheless reading the locked GDI+ Bitmap is approximately 30% faster than reading the FreeImage-bitmap.
Is there maybe a difference located behind the pointer access? Do you have any comment or explanation for that phenomenon?
Thanks,
Alex
|
|
|
|
|
Can someone help me, Please. I am trying to take a class in C#. The instructor has a set of problems for us which uses methods and the calling statement. For some reason I can't seem to figure out how these work. The way I understand it is that the method is a series of statements that do something and the call is supposed to have them do that and get a return out of it.
Can someone please give me a clue as how these things are supposed to operate, because I can't get them to do anything. I've been banging my head on a wall because the information isn't sinking in.
Any help will be apreciated. Thank you.
|
|
|
|
|
OK, basically a method is a group of C# statements that do something. They can do *anything* you like, but typically the idea is that a method is like a building block. Once you have the mould, you can make all the blocks you need. Once you define a method, you can call it whenever you like.
namespace test
{
static void Main()
{
Method1();
Method2();
Method1();
}
private void Method1()
{
Console.WriteLine("in method1");
}
private void Method2()
{
Console.Write("not ");
}
}
So, this example is trivial, usually a method would do a calculation, or connect to a datatabase, or some other 'useful' thing. The point is, I have two methods, and I can call each, as often and whenever I like. This means, for example, if my database won't connect, I know the database connect method is where I look for an error, instead of having one big clump of code and trying to work out which bit is running when the problem occurs.
You can also pass values into a method, and you can return values. A canonical example would be
private int Add(int x, int y)
{
return x + y;
}
No-one would write a method like this, but you see that to call this method, you need to give it two numbers to add, like this:
int total = Add(1, 6);
The variable called 'total' now equals 7. You can also pass values from variables, like so:
int v= 27;
int n = 1042;
int e = Add(v, n);
You'll note, the names don't have to be the same, you can use whatever names you like, they don't need to match the names given within the method signature, those names only exist so you can refer to the values within the method.
Does that help ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Would this work if you passed a variable from a GridViewEvent method to a DataListRow method within the same class?
|
|
|
|
|
hi
below code is giving me this error help me out
Error:
[HY000] [Microsoft][ODBC dBase Driver] External table is not in the expected format.
code:
string constr=("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=d:\\");
OdbcConnection cc = new OdbcConnection(constr);
cc.Open();
OdbcCommand cm = new OdbcCommand("select * from dd.dbf", cc);
//OdbcDataReader dr = cm.ExecuteReader();
OdbcDataAdapter da = new OdbcDataAdapter();
DataSet ds = new DataSet();
da.SelectCommand=cm;
da.Fill(ds);
y all this is to read a .dbf file that is a (free table)
|
|
|
|
|
Hi,
I hav a login page in my solution VS2005. If the user exist then it redirects it to my default.aspx page, if the userid or password is incorrect it display the error message, but after typing the correct info. of the user it does authenticate and authorized the user but it doesnt redirect you to the default.aspx page it will will just redirect you to the login.aspx displaying the userid that it is already authorized. Can somebody help me?
My solution: Login1.FailureAction = "Refresh" when I tried to swith it to Login1.FailuerAction = "RedirectToLoginPage" still the same problem. Could it be that I missed some codes coz everything in login page is working fine.
<br />
if (bUserExists)<br />
{<br />
string sroles = GetUserRole(Login1.UserName);<br />
FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket(1, Login1.UserName, DateTime.Now, DateTime.Now.AddMinutes(30), false, "Director", FormsAuthentication.FormsCookiePath);<br />
Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(Ticket)));<br />
Response.Redirect(FormsAuthentication.GetRedirectUrl(Login1.UserName, bIsPersistentChecked));<br />
}<br />
else<br />
{<br />
Login1.FailureText = "User Name / Password is not correct. please try again.";<br />
}
Dabsukol
|
|
|
|
|
Please help.
I got big problem.
I am working on plugins for my program. Load a list of plugins, double click on certain dll and it shows plugin window.
I have created a plugin and tried to test it, and I get this error: "Exception has been thrown by the target of an invocation"
This is the code that manipulates (calls them) with plugins:
Assembly ass = Assembly.LoadFile(Application.StartupPath + "\\Modules" + lwAddin.SelectedItems[0].SubItems[1].Text + "\\" + lwAddin.SelectedItems[0].Text);
Object o; Type t;
string str = lwAddin.SelectedItems[0].Text;
str = str.Substring(0, str.LastIndexOf("."));
t = ass.GetType(str);
o = Activator.CreateInstance(t);
Form frm = ((Form)(o));
frm.Show();
Variable str is in Namespace.ClassName format and I have test this code above with some sample module (just displays the window) and worked fine, so, I've created this new module, tried and get above error.
That plugin is added to my projects solution as class library project.
What should I do to avoid this?
Thanks in advanced.
|
|
|
|
|
Just a guess, but maybe the type you're trying to create has no default constructor.?
If that does not solve the problem, does the exception you get provide any inner exception and what does the stack trace look like?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks for your reply.
I've added an entry point and then tried, but same error appears.
Ironically, WindowsApplication project (made in VS2003), later converted to ClassLibrary, works great with my module code posted above, so I stopped trying to get it to work and create it as a standalone program rather then module .
Maybe it is some simple mistake I made occasionally and didn't realized it until I start testing .
Anyway, here's the stack trace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at ProjectCube.frmModules.lwAddin_DoubleClick(Object sender, EventArgs e) in E:\Development\Current Projects\Modules\Forms\Modules.cs:line 86
at System.Windows.Forms.Control.OnDoubleClick(EventArgs e)
at System.Windows.Forms.ListView.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at ProjectCube.frmMain.tbAddIn_Click(Object sender, EventArgs e) in E:\Development\Current Projects\Modules\Forms\MainForm.cs:line 435
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ProjectCube.Program.Main(String[] args) in E:\Development\Current Projects\Modules\Program.cs:line 37
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
|
|
|
|
|
Hi:
This is my first time posting to this board and I'm relatively new to programming with Visual Studio 2005 but I'm not new to programming in general.
I have a database app which uses a DataGridView control with 4 columns displayed. This is constructed with drag and drop from Data Sources and works well.
I would like to provide a textBox control that indexes into the "Name" column of the Grid View as a string is typed in the box. I.E. if I type a "V" the grid goes to the first name which starts with V then as I type the rest of the name it goes to the first name that starts with the letters in the textbox. The user can continue typing until he types the entire name or sees the name he wants and selects it with the mouse.
Is there a control to do this?
Thanks
Edwin
|
|
|
|
|
I am making a window for editing text in a textbox control, but I am having a problem... Here are pictures of my window before and after resizing: Image[^] As you can see, the SizeGripStyle object goes underneath the text box. This is how I am coding my window:
<br />
class FileWindow : Form {<br />
TextBox test;<br />
<br />
public FileWindow() {<br />
test = new TextBox();<br />
test.Multiline = true;<br />
test.WordWrap = false;<br />
test.ScrollBars = ScrollBars.Both;<br />
test.Location = new Point(0, 0);<br />
test.Size = new Size(this.Width-8, this.Height-33);<br />
test.Font = new Font("Courier New", 10);<br />
<br />
this.Controls.Add(test);<br />
this.Resize += new EventHandler(ResizeTextBox);<br />
this.SizeGripStyle = SizeGripStyle.Show;<br />
}<br />
<br />
public void ResizeTextBox(object sender, EventArgs e) {<br />
test.Size = new Size(this.Width-10, this.Height-35);<br />
}<br />
}<br />
(Sorry for having a whole bunch of code; I figured any of it might have been the problem)
Any ideas on why my window is doing this?
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
Maybe because the TextBox isn't anchored to all four sides of the Form?
P.S. I always hide the size grip; it's ugly and unnecessary.
|
|
|
|
|
How can I get this: Image[^] (The dark blue arrow on the side of the ToolStrip that expands to show more options) to show up on my ToolStrip objects? And after I get it on there, how do I manipulate its contents?
Another thing... I've got how you can drag the ToolStrip to the different edges of the window, but how do you do the thing where you drag it into the middle, and it floats seperately as its own window, like in Microsoft Word?
One more thing... (sorry ) How can you make the MenuStrip have the ability to be dragged to different edges of the window, like the ToolStrip can? And also, do you do the same thing for the MenuStrip as with the ToolStrip to make it float?
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
Hello everyone,
I was wondering if it is possible to create a window application with rather personalized window. What I mean is that I wish to have a different graphic rather than usual window from.
Thanx in advance for your help.
Khoramdin
|
|
|
|
|
Yes, but you shouldn't; people expect windows to look a certain way. I detest odd-looking windows. If I had to choose between two applications with similar functionality and one was non-standard I'd choose the other.
|
|
|
|
|
Hello PIEBALDconsult,
Thanx for sharing your valuable opinion. The reason I asked about the personalized window was that I have this Window application which I wish to add a floating menu to it. As the result I didn't want it to look like a normal Window Form.
This is a medial player application that I have and wish to place its control buttons in a separate window.
Maybe you can tell me if there is a better way to deal with something like this.
Thanx in advance for your input, mate.
Khoramdin
|
|
|
|
|
Hi,
This is really frustrating me. I know it should be simple but I'm darned if I can get my mind around it.
psuedo code:
datetime = aDate
string xyz = aDate.ToString("MMM dd, yyyy");
I know I can Stringbuild what I want but surely there is a simpler way. Someone please kick me in the head
Thanks.
Glen Harvy
|
|
|
|
|
You can use ToShortDate(), or you can pass a format string to ToString, although I'm not sure it looks like what you posted ( it might )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
G'day,
Thanks for your help - I played around with the .ToShortDate() but I still couldn't then format that into MMM dd, yyyy.
Ed.Poore's suggestion has done the trick though .
Cheers,
Glen Harvy
|
|
|
|
|
Could use CG's suggestion or string xyz = string.Format("{0:MMM dd, yyyy}", aDate);
|
|
|
|
|
G'day,
Great stuff - works well
I just knew that I had seen/read this somewhere and hence knew there was a simpler way.
Much appreciated.
Cheers
Glen Harvy
|
|
|
|
|
Not a problem
|
|
|
|
|
Is there an inherent limitation to the amount of available memory for a 32bit .NET application? For a simple test I'm running out of memory at around 1.4 to 1.6gb.
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
namespace MemoryTest
{
class Program
{
static void Main(string[] args)
{
int count = 0;
int size = 1024 * 1024 * 100;
byte[][] buffer = new byte[1024][];
try
{
do
{
buffer[count] = new byte[size];
Array.Clear(buffer[count], 0, buffer[count].Length);
Console.Out.WriteLine("count={0} size={1}", count.ToString(), buffer[count].Length.ToString());
MessageBox.Show("Click Ok to continue", "Got RAM?", MessageBoxButtons.OK, MessageBoxIcon.Question);
count++;
} while (true);
}
catch (Exception e)
{
Console.WriteLine("{0} Exception caught (count={1})", e, count.ToString());
}
}
}
}
Todd Smith
|
|
|
|
|
There is an inherit amount of memory available on your specific computer, that's for sure. I've run apps over the 1.4 gig mark, but I fixed them
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|