|
Thank you very much. But my main problem is not how to create browser, it's how can I pop my windows form up when a link is clicked.
|
|
|
|
|
Hi,
Can someone please tell me how can I zoom in and out of an image that is displayed in a picture box control???
Please Help...
Thanks,
E.A.
|
|
|
|
|
You can't. So many people seem to think a picture box control should be a full featured image viewer, and it's not. It's for showing a picture. If you want to do anything more, you'll have to write the code yourself. I prefer to put a panel on my form and use it to work out the bounds to draw my own images for this very reason, it means I have full control. The Graphics.DrawImage method has a number of overloads, and all are designed to be able to zoom into an area of an image and/or draw only part of the image.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yup, ehat Christian said. Or you can use the search function of Codeproject : PictureBox with zooming and scrolling[^].
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Inconsistent accessibility: parameter type 'HDRImaging.HDRImage' is less accessible than method 'HDRImaging.ImagePyramid.ImagePyramid(HDRImaging.HDRImage)'
What does this mean ? The error is here :
public class ImagePyramid
{
private HDRImage source;
public ImagePyramid(HDRImage bitmap) <----- error !!!
{
source = bitmap;
}
in the constructor. The HDRImage class is in the namespace and has several public constructors.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Don't worry, I found it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am writing a C# app and I want to store the bits of a bitmap in an array. So I have declared an array to hold the right number of bytes, and I have a byte *, but is there any way to copy the data into the array in one go, instead of one item at a time ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Marshall.Copy seems to do the trick
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
There doesn't seem to be a SelectedIndex property for a listview control. As I did with a listbox's SelectedIndex I need to be able to get the int index value of whichever item is selected in the listview. I have set the listview's multiple selection to false as I only want one item selected.
How can i find out what the index is of the selected item??
Could someone please show me in code??
|
|
|
|
|
Look again, there _is_ a SelectedIndices and a SelectedItems property.
mav
|
|
|
|
|
Yes but these are read only. SelectedIndices returns a collection not an index number and SelectedItems also returns a collection. I need just the selected items index number.
|
|
|
|
|
Ermm SelectIndices return a collection of Items Index Number that has been selected, isnt that what you wanted? I thought Mav.Northwind hit the mark.
|
|
|
|
|
if (this.listView1.SelectedIndices.Count > 0)
{
/*
* This will simply return the first index.
* If you set the MultiSelect property to false,
* that's all you need. Otherwise, just iterate
* through the array with a for
*/
int i = this.listView1.SelectedIndices[0];
}
This should do the trick.
Hope it helps,
azazel
|
|
|
|
|
Hey guys,
I'm using the following code to connect to my remote mysql database. Of
course I changed the server, database name, login/pass info, for my
posting on the web...
string connectString="DRIVER={MySQL ODBC 3.51 Driver};SERVER=xxx.xxx.xxx.xx;PORT=3306;DATABASE=dbName;UID=userName;PASSWORD=xxxxxxxxx;OPTION=3";
OdbcConnection connection = new OdbcConnection(connectString);
try
{
OdbcConnection connection = new
OdbcConnection(connectString);
}
catch (System.Exception e)
{
Console.WriteLine(e.Message);
}
finally
{
Console.WriteLine("ERROR");
}
When I run the program it does NOT go in the catch statement (but goes into the finally). Using a debugger I can see that my connection state is closed the entire time. I installed the ODBC driver and added my database connection (which it succesfully connects to) to the "Data Sources (ODBC)" component of the administrative tools. I named this connection "CSDatabaseServer". So I also tried setting my connectString="DSN=CSDatabaseServer". That did not work either however.
Any help would be appreciated, thanks guys.
|
|
|
|
|
telconstar99 wrote: my connection state is closed the entire time
That's because you never call connection.Open() .
Have you tried that:
<br />
OdbcConnection connection = new OdbcConnection(connectString); <br />
try<br />
{<br />
connection.Open();<br />
}<br />
catch (System.Exception e)<br />
{<br />
Console.WriteLine(e.Message);<br />
Console.WriteLine("ERROR");<br />
}<br />
finally<br />
{<br />
Console.WriteLine("FINISHED, with errors or not.");<br />
connection.Close();<br />
} <br />
Note that the finally block is always reached. It's for lines that must be executed in any case, no matter if exceptions occurred ot not.
_________________________________
Please inform me about my English mistakes, as I'm still trying to learn your language!
|
|
|
|
|
Thanks for the help man. That's all it needed. The tutorial I was going through didn't do that...which seems very strange. Now that I'm looking for it I noticed other tutorials did that step. Thanks!
|
|
|
|
|
Your tutorial is for .NET 1.0, Open() was new in .NET 1.1.
_________________________________
Please inform me about my English mistakes, as I'm still trying to learn your language!
|
|
|
|
|
hi i want to create iso image, but i don't know how can i ..
please help me ...
hdv212@yahoo.com
|
|
|
|
|
my first guess would be to find the file format for iso specification, i imagine it is readily available.
i have never done this but when i was tinkering with zip creation i needed to know the file spec before i could create one
maybe this[^] can get you started
hope that helps
g00fy
|
|
|
|
|
The format is available, but sometimes it can be a bit fuzzy what they mean. I glanced at an open source implementation (can't remember the name, it was a command line thingy normally available on for example Linux). This was for an internal use only project, so GPL code was not a problem but you should be careful if you need to release the program.
It is relatively easy task, but I would still estimate a week to do it (and I have done it before).
|
|
|
|
|
Hello..
I simply want to develop a stock program but somewhere I make smth. wrong and I cannot say where.. My program seems write into file in binary mode but connot recover the data correct.. The problem is , I enter 3 samples fırst.. then I want to edıt 3.rd one , when ın debug mode , I can get first 2 item's data but when 3rd , It throws an exception "Unable to read beyond the end of the stream." Can anyone help me what is wrong with my code? Thanks..
using System;
using System.Data;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
namespace fileodevi
{
public struct type//yenı urun ıcın kullanılacak struct type
{
public string name;
public double price;
public int stok;
public const int SIZE = 36;
}
class Class1
{
private const string fileName = "file1.dat";
private BinaryWriter writer = null;
private BinaryReader reader = null;
public FileStream file = null;//global deklerasyon , daha sonra her yerde kullanalım dıye..
public Class1()
{
do
{
try
{
file = new FileStream(fileName,FileMode.OpenOrCreate);
Console.WriteLine("File created(if NOT exists / Opened(if exists)");
break;
}
catch(Exception exp)
{
Console.WriteLine(exp);
file.Close();
}
}while(true);
file.Close();
}
public void enterNewProduct()
{
type newProduct = new type();
do
{
try
{
file = new FileStream(fileName , FileMode.Append , FileAccess.Write);
Console.WriteLine("File opened for writing new entry");
break;
}
catch(Exception ex)
{
Console.WriteLine(ex);
}
}while(true);
//urun adı
Console.WriteLine("Enter name of the new product :");
Console.WriteLine("WARNING name MUST be at most 20 characters!!\n");
do
{
newProduct.name = Console.ReadLine();
if(newProduct.name.Length < 20)
{
newProduct.name += new string(' ',20-newProduct.name.Length);
}
}while(newProduct.name.Length > 20);
//urun fıyatı
Console.WriteLine("Enter Price of the new product :");
do
{
try
{
newProduct.price = double.Parse(Console.ReadLine());
break;
}
catch(FormatException e)
{
Console.WriteLine(e);
}
}while(true);
//urun adedı
Console.WriteLine("Enter amount of the product :");
do
{
try
{
newProduct.stok = Int32.Parse(Console.ReadLine());
break;
}
catch(FormatException ex)
{
Console.WriteLine(ex);
}
}while(true);
//urunu fıle a kaydetme
do
{
try
{
writer = new BinaryWriter(file);
writer.Write(newProduct.name);
writer.Write(newProduct.price);
writer.Write(newProduct.stok);
Console.WriteLine("Product successfully entered to file");
writer.Close();
file.Close();
Console.WriteLine("File closed");
break;
}
catch(Exception b)
{
Console.WriteLine(b);
}
}while(true);
}
public void editProduct(string name)
{
type pro = new type();
if(name.Length < 20)
{
name += new string(' ' ,(20-name.Length));
}
do
{
try
{
file = new FileStream(fileName,FileMode.Open,FileAccess.ReadWrite);
Console.WriteLine("File opened for Editing");
break;
}
catch(Exception ex)
{
Console.WriteLine(ex);
}
}while(true);
reader = new BinaryReader(file);
for(int b = 0;;b++)
{
pro.name = reader.ReadString();
pro.price = reader.ReadDouble();
pro.stok = reader.ReadInt32();
int sel = 0;
try
{
if(string.Equals(name , pro.name))
{
reader.Close();
Console.WriteLine("What attirbute dou you wish to change ? :");
Console.WriteLine(" 1) Name\n 2) Price\n 3)Amaount in stock");
sel = Int32.Parse(Console.ReadLine());
switch(sel)
{
case 1:
Console.WriteLine("Enter new Name of the product :");
Console.WriteLine("The name must be at most 20 characters\n");
do
{
pro.name = Console.ReadLine();
if(pro.name.Length < 20)
{
pro.name += new string(' ',(20-pro.name.Length));
Console.WriteLine(pro.name.Length.ToString());
}
}while(pro.name.Length > 20);
break;
case 2:
Console.WriteLine("Enter new Price of the product :");
do
{
try
{
pro.price = double.Parse(Console.ReadLine());
break;
}
catch(Exception ex)
{
Console.WriteLine("Invalid amount try again..");
}
}while(true);
break;
case 3:
Console.WriteLine("Enter new stock number :");
do
{
try
{
pro.stok = Int32.Parse(Console.ReadLine());
break;
}
catch(Exception ex)
{
Console.WriteLine("Invalid amount try again..");
}
}while(true);
break;
}
writer = new BinaryWriter(file);
writer.Seek(b*(type.SIZE),SeekOrigin.Current);
try
{
writer.Write(pro.name);
writer.Write(pro.price);
writer.Write(pro.stok);
writer.Close();
file.Close();
Console.WriteLine("File Closed , writer closed");
}
catch(Exception ex)
{
Console.WriteLine("Error writting");
}
break;
}
else
{
file.Seek(b*(type.SIZE),SeekOrigin.Current);
}
}
catch(Exception ex)//File ıcınde obje bulamadıgı zaman veya okurken bı hata ıle karsılasırsa...
{
Console.WriteLine("No such Item Found...");
file.Close();
break;
}
}
}
[STAThread]
static void Main(string[] args)
{
char sel ;
Class1 c = new Class1();
while(true)
{
Console.WriteLine("A) To enter a new product");
Console.WriteLine("B) Edit a product");
Console.WriteLine("C) Order a product");
Console.WriteLine("D) Exit program");
do
{
try
{
sel = char.Parse(Console.ReadLine().ToLower());
break;
}
catch(Exception)
{
Console.WriteLine("The Input command is invalid.Try Again..");
}
}while(true);
if( sel == 'a')
{
c.enterNewProduct();
}
if(sel == 'd')
{
break;
}
if(sel == 'b')
{
Console.WriteLine("Enter the name of the product you wish yo edit :");
c.editProduct(Console.ReadLine());
}
}
}
}
}
Revelation 22:13
-- modified at 15:58 Sunday 6th November, 2005
|
|
|
|
|
Use the pre tag to keep the indentation of the code when you post it.
---
b { font-weight: normal; }
|
|
|
|
|
Hi
I have trouble in setting the displaymember in a dataset-binded combobox.
My Code:
this.cselectName.DataSource = this.selectExpensePropertiesDataSet1.cPerson;
this.cselectName.DisplayMember = "LastName";
this.cselectName.Location = new System.Drawing.Point(368, 16);
this.cselectName.Name = "cselectName";
this.cselectName.Size = new System.Drawing.Size(144, 21);
this.cselectName.TabIndex = 6;
this.cselectName.Tag = "";
this.cselectName.ValueMember = "pID";
I tried to set a DisplayMember as default value selected using the following code:
cselectType.SelectedIndex = cselectType.FindStringExact("Miete");
Hasn't worked.
Any ideas?
Thanks in advance.
Jens
-- modified at 15:38 Sunday 6th November, 2005
|
|
|
|
|
hi i am c# programmer and thank you for your site . it is best programming site .
how to get serial number of cd in c# ?
please help me ...
thanks
hdv212@yahoo.com
hdv212@yahoo.com
|
|
|
|
|
Hi i am new to C# and would like to ask for some helps here on array
The scenario is like this,
I need to create a form with a combobox for a restaurant which store a series of food and their respective prices. When any food items on the combobox is checked, the name and price of the name is supposed to be appeared on a listbox.
http://photobucket.com/albums/c358/pearhk2/?action=view¤t=asg1.jpg[^]
I managed to get the name of the food appear on the listbox but cant get the price corresponding to them listed
//Food Prices
decimal[] FoodPrice = new decimal[] {5, 5.5M, 6, 6.5M, 7, 7.5M};
//Selected Food Name listing on MealList Box
MealList.Items.Add(FoodBox.Text);
The above line is how i add the food name on the list, may i know how to add the price of the chosen item too? i tried going through my textbook still cant get it done
Any helps will be much appreciated, Thanks in advance!
|
|
|
|