|
1.
engsrini wrote: 1. Is my windows application a single threaded or multithreaded?
find the Main in your app. if use [STAThread], that means single threaded.
if you use [MTAThread], that means multi-thread.
<br />
[STAThread]<br />
static void Main()<br />
{<br />
Application.Run(new demo());<br />
}<br />
4. different between STA and MTA
|
|
|
|
|
hi all i have an application that can call up records in a set of database. i can do the navigate, delete update and insert functions.. however i wish to include sort and filter functions for my application.. how do i go abt doing this? any links or articles will be greatly appreciated thanks
|
|
|
|
|
I think you use the DataView for that
|
|
|
|
|
Hi,
Consider a class that I need to serialize and send over the wire. On
the receiving end, the serialization bytes have to be re-constructed to
form the object. The mentioned class has got some member variables and
one or more constructors.
[WebMethod()]<br />
public void Test(MyClass c) {}
The question is that is there anyway to control the proxy-generation
for the MyClass class? i.e, how am I supposed to force the
proxy-generator to generate the constuctors? Or should I add the
required constructors on the client side using the partial keyword?
What's the best thing to do when you want to pass a one-way informative
parameter (ie., no functionality embedded except for the constructors)
to a web method?
I would like the client side to create the object normally as follows:
MyWebService.MyClass c = new MyWebService.MyClass(param1, param2);<br />
MyWebService.Test(c);
Is there anyway to achieve such functionality?
TIA,
Mehdi
|
|
|
|
|
After the code has been generated, you can add them. As long as you stick to serialization standards (mark your public properties/fields as XmlIgnore, and dont delete their fields!).
If using .NET 2.0, partial classes gets generated, and hence u can define them in another file without worrying that regeneration will erase your changes.
|
|
|
|
|
Is there any keyword and/or pragma (like the one used in IDL (C++)) to force the compiler to put some code in the generated class? something like:
#include_this_in_generated_code "public void WhateverMethod() {}"
This way, I could alter the proxy code on service-side.
Thanks,
Mehdi
|
|
|
|
|
Okay, I've tinkered with this code and have not been able to get an image to display:
http://www.codeguru.com/Csharp/Csharp/cs_controls/datagrid/article.php/c4783/#more[^]
Basically, I am designing a drag and drop where I create a thumbnail for each image dragged and put that image into a table. I want everything in one row so I create a column for each image dragged. Then I create a new GridTableStyle for each new column. Then I set the DataSource. I'd like to do this with the use of a dataset, but I not picky just so long as I can get it to work.
So far all I get is a big white box with a giant Red "X" through it. Anyone have any ideas? Thanks in advance!
Here is my code:
public void ImageLoader()
{
//Create Thumbnails
foreach(string fn in files)
{
try
{
ImageConverter(fn);
}
catch(Exception)
{
}
}
//ids is Image-DataSet
ids.Tables.Add(dt);
getGridTableStyle();
image_Datagrid.TableStyles.Add(DGStyle);
image_Datagrid.DataSource = ids;
image_Datagrid.DataMember = dt.TableName;
}
private void ImageConverter(string filename)
{
string imageFile = Path.GetFileNameWithoutExtension(lastFilename).ToLower();
//Create and Save the Thumbnail and return the image
Image img = CreateThumbnail(filename);
//Put the image in the DataTable and name the column the image name without
//extension or directory info i.e. 'c:\\test.bmp' uses 'test' as the column name
AddThumbnailToDataTable(img, imageFile);
}
private void AddThumbnailToDataTable(Image img2, string columnName)
{
dt.BeginLoadData();
this.dt.Columns.Add(columnName);
this.dt.Rows[0][columnName] = (Bitmap)img2;
dt.EndLoadData();
}
private void getGridTableStyle()
{
try
{
DataGridColumnStyle GridTextColumn, GridBmpColumn;
DGStyle = new DataGridTableStyle();
// select table
DGStyle.MappingName = "Images";
// Use a PropertyDescriptor to create a formatted column. First get the PropertyDescriptorCollection
// for the data source and data member.
PropertyDescriptorCollection pcol = form1.BindingContext[ids, dt.TableName].GetItemProperties();
// create the first column style for a text column
GridTextColumn = new DataGridTextBoxColumn(pcol["ImageInfo"]);
GridTextColumn.MappingName = "ImageInfo";
GridTextColumn.HeaderText = "Image-Name";
GridTextColumn.Width = 50;
DGStyle.GridColumnStyles.Add(GridTextColumn);
//Create an ImageColumn for each image in the table
for(int i = 1; i < dt.Columns.Count; i++)
{
// create column style for an image column
GridBmpColumn = new DataGridImageColumn(pcol[dt.Columns[i].ColumnName]);
GridBmpColumn.MappingName = dt.Columns[i].ColumnName;
GridBmpColumn.HeaderText = "Bitmap";
GridBmpColumn.Width = 80;
DGStyle.GridColumnStyles.Add(GridBmpColumn);
}
DGStyle.RowHeadersVisible = false;
}
catch(Exception e)
{
MessageBox.Show(e.Message, "Adding Images to Grid TableStyle");
}
}
Thanks!
RABB17
|
|
|
|
|
Figured it out. If anyone ever wants to do this:
Don't pass an image to the datatable, instead pass the location of the new file.
Then in the DataGridImageColumn class make the following adjustment:
string ImageFile = (string)GetColumnValueAtRow(Source, RowNum);
Image img = Image.FromFile(ImageFile);
Bitmap ImagePic = (Bitmap)img;
Problem is that when you put the image file in the table, it can only hold a limited number of bytes for it (8kb) and you lose much of the image's data.
Hope this helps someone one day,
RABB17
|
|
|
|
|
Hello,
I use InternetExplorer object to go to an url through IE. But, the page requires user name and password login. The boxes are in a popup dialog (javascript I think).
How can I fill in the user name and password?
Moreover, how can I click the button ('Yes') in the popup dialog?
Thanks for your help!
|
|
|
|
|
You call the url with the user pass embedded.
IOW http://user:pass@www.foo.com
Should work, well it did many years back
|
|
|
|
|
sorry, the page fails to be displayed if I type: https//user:pw@www.mypage.com
Any suggestion please?
|
|
|
|
|
Archyami wrote: https//user:pw@www.mypage.com
https://user:pw@www.mypage.com
|
|
|
|
|
"The page cannot be displayed"
|
|
|
|
|
Just to make sure:
Did you replace "user" and "pw" in the URL with the actual user name and password?
---
b { font-weight: normal; }
|
|
|
|
|
yes.
https://myname:mypw@mypage
-> "The page cannot be displayed"
https://mypage
-> popup a dialog for username and pw
|
|
|
|
|
There is a "security alert" popup dialog from windows before the popup login.
Is it the cause of failure using
https://myname:mypw@mypage
?
If so, how to avoid the "security alert" popup dialog?
Thanks!
|
|
|
|
|
hi all i have searched the codeproject for password related articles but to no avail..can anyone provide me with any links or articles that do an application that requires the user to input a password and to verify before allowing him to continue with the application??
|
|
|
|
|
Well, it's kind of trivial. The hard part is deciding how to store your password and how secure you want it to be. All you need is a form that takes a username and password and that needs to return success before the rest of the app runs.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
ok thanks do u have a sample application or link where i can get to analyse the source codes? appreciate for yr help
|
|
|
|
|
Not really. Create a form that takes a username and password, and have your code call it. Hook up the OK and Cancel buttons to DialogResult.OK and Cancel. Make the OK button not work unless the username/password is correct. Have your app close if the dialog returns DialogResult.Cancel.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Is there an open source or free Checked ComboBox in .Net, either C# or VB.Net?
I have been searching high & low but to no avail.
|
|
|
|
|
Finally i found a link in codeproject.com after two weeks of searching..
The URL is
http://www.codeproject.com/cs/miscctrl/customcombos.asp
Mmm. The strange think i found the link from
http://www.tech-archive.net/.
Looks like Codeproject search engine should be improved.
|
|
|
|
|
Hi,
I am trying to find out why my program isn't working so I inserted a breakpoint where the error occurs. When I then step thru after checking the variable is populated in the "locals" window everything works fine. I remove the breakpoint and it falls over again.
Background:
There is a combobox populated with dates gathered from a database. The selected combobox.text value is then used to pass into a oledb select command to populate a datagrid. Excerpts are:-
string fDate = this.comboBoxTresReport.Text.ToString();
DateTime fromDate = Convert.ToDateTime(fDate);
When I put a breakpoint at the first line AND I CHECK THE VALUE OF THE VARIABLE CONTAINED AT this.comboBoxTresReport.Text the program steps thru Ok. Remove the breakpoint OR I do not check the variable this.comboBoxTresReport.Text the second line generates an error "String was not recognized as a valid DateTime."
What have I missed doing?
Glen Harvy
|
|
|
|
|
This means you have a race condition. Stopping the program means that everything sorts itself out in the time it takes for the breakpoint. Is the app multithreaded ?
Ah.... that's interesting. Obviously, checking the text has a side effect on the code. What if you add a line like string s = this.comboBoxTresReport.Text , does that solve the problem ? Note, I am not advocating this as a solution, just wondering if the root issue is that when the string is first evaluated, it works for some reason.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks for your prompt response.
Christian Graus wrote: Is the app multithreaded ?
Being new to this I really don't know if it is or isn't. I haven't specifically done anything to make it so or otherwise .
Christian Graus wrote: What if you add a line like string s = this.comboBoxTresReport.Text
I added that to code just before mine and it didn't make any difference.
Glen Harvy
|
|
|
|