|
Hi Richard,
Yes you are right. In C#, what is the best approach to open up and access the file then? I started to look yesterday and there are streamreaders, binaryreaders, filereaders, etc. I am a bit lost hence this post.
Thanks,
|
|
|
|
|
You will probably need to use a FileStream[^] to access the file, as it allows you to position the file pointer (seek) and read arbitrary amounts of binary or textual information.
It's time for a new signature.
|
|
|
|
|
Starting the right way then
Hey, thanks for the help, Richard, I appreciate it.
Best regards,
Antoine
|
|
|
|
|
i want to set html color code to forecolor of a label, i found the colorconverter.convertfromstring (),
is there any method that takes directly hexa vales to create the color in .net ..thanx
|
|
|
|
|
the Color constructors are documented in MSDN.
|
|
|
|
|
System.Drawing.Color myOrangeColor = System.Drawing.ColorTranslator.FromHtml("#CE560C");
(Remember, google is still out there)
The mind is like a parachute. It doesn’t work unless it’s open.
|
|
|
|
|
Create Procedure MultiTable
As
Begin
Select Name, Email from A
Select X,Y from B
Select J, K from C
End
When We call this Sp return result set in tables as table, table1, table2.
Can we give these table name what we want?
I mean instead of table, table1 it should give A,B..
SqlConnection conn = new SqlConnection("Con String");
SqlDataAdapter da = new SqlDataAdapter("MultiTable",conn);
da.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
da.Fill(ds);
|
|
|
|
|
You cannot decide name of the resultset inside the SP.
The ADO.NET will give the default name, like
first resultset has name "Table",
second has "Table1", and so on.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Folloowing on from the above answer, ADO.NET assigns the first resultset the name "Table", the second "Table1", the third "Table2" and so on.
Therefore you can map these table names to names of your choosing:
da.TableMappings.Add("Table","A");
da.TableMappings.Add("Table1","B");
da.TableMappings.Add("Table2","C");
|
|
|
|
|
You could also add the tablenames as out parameters in the stored procedure.
@Table Text OUTPUT
,@Table1 Text OUTPUT
AS
BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SET @Table = 'FirstTableName'
SET @Table1 = 'SecondTableName'
-- Insert statements for procedure here
SELECT * FROM A
SELECT * FROM B
END
And in code you just match the tablenames:
foreach (SqlParameter p in dataAdapter1.SelectCommand.Parameters)
{
dataSet1.Tables[p.ParameterName].TableName = (string) p.Value;
}
|
|
|
|
|
You can also bang in a nail with a pair of pliers - doesn't mean its a good idea!
|
|
|
|
|
If you only got pliers, than it's a good idea...
|
|
|
|
|
Only if you, or the person who has to maintain your code, don't need to use the pliers later...
|
|
|
|
|
|
This would appear to be either a VB.NET or COM question, I see nothing about C# here. Try posting in the correct forum.
It's time for a new signature.
|
|
|
|
|
Hi,
Have resize the image to fit the picture box (for other purpose). now i tried to zoom in the image and i succeed on it. but my problem is when i zoom the image the image get zoomed and image moves toward right.
if I use zero instead of c(in below code) the image placed at the left corner and when zoomed it starts from there. but i need to place the image in that particular location.
How can zoom the image without changing the position of the image.
Thanks in advance.
<br />
private Image resizeimage(Image my, Size sz1)<br />
{<br />
double ratio = 0d;<br />
double myThumbWidth = 0d;<br />
double myThumbHeight = 0d;<br />
Bitmap bp;<br />
int c;<br />
int d;<br />
<br />
if ((my.Width / Convert.ToDouble(sz1.Width)) > (my.Height /<br />
Convert.ToDouble(sz1.Height)))<br />
ratio = Convert.ToDouble(my.Width) / Convert.ToDouble(sz1.Width);<br />
else<br />
ratio = Convert.ToDouble(my.Height) / Convert.ToDouble(sz1.Height);<br />
<br />
<br />
myThumbHeight = Math.Ceiling(my.Height / ratio);<br />
myThumbWidth = Math.Ceiling(my.Width / ratio);<br />
Size thumbSize = new Size((int)myThumbWidth, (int)myThumbHeight);<br />
bp = new Bitmap(sz1.Width, sz1.Height);<br />
c = (sz1.Width - thumbSize.Width) / 2;<br />
d = (sz1.Height - thumbSize.Height);<br />
System.Drawing.Graphics g = Graphics.FromImage(bp);<br />
g.SmoothingMode = SmoothingMode.HighQuality;<br />
g.InterpolationMode = InterpolationMode.HighQualityBicubic;<br />
g.PixelOffsetMode = PixelOffsetMode.HighQuality;<br />
rect = new Rectangle(c, d, thumbSize.Width, thumbSize.Height);<br />
g.DrawImage(my, rect, 0, 0, my.Width, my.Height, GraphicsUnit.Pixel);<br />
if (f == false)<br />
{<br />
sz = bp.Size;<br />
pictureBox1.Size = sz;<br />
}<br />
rect = new Rectangle(0, 0, 0, 0);<br />
return (bp);<br />
public void ZoomIn()<br />
{<br />
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;<br />
if (sz.Width >= c)<br />
MessageBox.Show("Max ZoomIn");<br />
else<br />
{<br />
sz.Width += 50;<br />
sz.Height += 50;<br />
<br />
pictureBox1.Size = sz;<br />
pictureBox1.Invalidate();<br />
}<br />
<br />
|
|
|
|
|
Please any one answer this one please.....
|
|
|
|
|
Hi sir,
When i type in combo edit box any character,i am find the character typed with the string.
Its all working fine.
But the problem i am facing is
1) When i select any value from the dropdown combo,
the value is not setting to
edit box combo,as the dropdown is showing again
2)After getting the dropdown list,if i tried to select the
value from keyboard "i.e by pressing down key arrow",
the value is not setting and i am getting empty value in edit box.
Here is the code ,i am trying with
private void comboBox1_TextChanged(object sender, EventArgs e)
{
int j = 0;
string str,strTemp,str1;
str = comboBox1.Text;
comboBox1.Items.Clear();
for (int i = 0; i < List.Count; i++)
{
j++;
string value = List[i] as string;
str1 = value.ToUpper();
strTemp = str.ToUpper();
if (str1.IndexOf(strTemp) != -1)
{
j++;
comboBox1.Items.Add(value);
}
}
int k = str.Length;
comboBox1.Select(k, k++);
comboBox1.DroppedDown = true;
}
As i am new to C#.I am confused a bit.
Any idea will be really helpful
Thanks
Raj
|
|
|
|
|
I think that using comboBox1.Items.Clear(); is not a correct thing to do (it messes up all you selected items and so on).
All your code can be replaced (if you use .net 2 or greater) with the functionality of the autocomplete[^] feature.
I have no smart signature yet...
|
|
|
|
|
Hi sir,
Thanks a lott,its working fine now.
Thanks
Raj
|
|
|
|
|
Hello.
I am creating two application in C# one is for send message to another IP of my LAN. One that given IP i have another application in C# which is to receive that Message.
I am using Socket Programming but getting error
Doing like this...
http://www.c-sharpcorner.com/uploadfile/dottys/socketprogdtrp11222005023030am/socketprogdtrp.aspx
suggest me...
shafiq
|
|
|
|
|
Judging by the responses to that article, I'd run fast and far from that site. I appears to be populated by idiots.
First off, at least tell us what error you're getting from your code. It's very likely that someone here has already seen the same message and knows what it takes to fix it. If not, at least it will provide a clue to the solution. "getting error" tells us nothing.
Secondly, spend some time browsing the articles here at CodeProject about socket communications. The articles here are written by professionals, are peer-reviewed, and cover a vast array of different approaches and solutions to common and unique problems. You will very likely find the solution simply by comparing your code to something already posted here.
Good luck!
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Hey Roger Wright..
Thnk for relpy, actually i dont have any knowledge about how to send data from one application to another over LAN or another application on same machine.
So i copied and paste that article code.
But getting error........
Only one usage of each socket address (protocol/network address/port) is normally permitted.
Regards...
Shafiq
|
|
|
|
|
Shafiq4Code wrote: actually i dont have any knowledge about how to send data from one application to another over LAN or another application on same machine.
May I suggest you spend some time learning the subject before trying to implement some code that you cannot understand. There are many articles here on CodeProject that will give good explanations as well as source code. There are also lots of good learning resources on the internet that you should be able to find via Google.
It's time for a new signature.
|
|
|
|
|
Thanks for reply
Can u please suggest me what thing i need to learn to accomplish this.
|
|
|
|