|
I'm not really sure about it, but because there is only one line where you convert something I would
replace
Convert.ToInt32(paymentCategoryComboBox.SelectedItem)
with
Convert.ToInt32(paymentCategoryComboBox.SelectedItem.ToString())
But in general SelectedItem is not from the type 'System.Data.DataRowView' so I'm a little
bit confused with it. But maybe that helps.
Greetings
Covean
|
|
|
|
|
Many thanks for your reply.
Sill me realised that I needed SelectedValue instead of selectedItem to do the job.
The perils of late night coding .......
|
|
|
|
|
Hehe.
On the other hand its sometimes very funny to look over code you wrote in a stressful time.
Sometime its a bloomer just for the Coding Horrors section.
Greetings
Covean
|
|
|
|
|
What type is the SelectedValue?
If it's an int, why convert an int to an int? Just cast it.
If not, then you can probably cast it anyway.
I find the Convert class to be nearly entirely useless; try not to use it.
|
|
|
|
|
Dear All,
I am making a project using ASP.Net and C#.
I have a text box where i enter the amount. What i want is that when the user goes to the next field, i want the amount to the formatted in the following way:
For example, if the entered amount is 100000; i want it to be formatted as
Rs. 1,00,000.00
This Rs. is for Indian Rupees. This can be US Dollors or Euro also.
Request your help please.
Thanks
Sajit
modified on Wednesday, November 11, 2009 4:14 AM
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:17am.
|
|
|
|
|
Is there any other method of doing this.......
please advise
Thanks / Sajit
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:04am.
|
|
|
|
|
I have never created a masked text box. Can you help me in creatng it for this purpose. This is a web application.
It would be great if help is provided.
Thanks / Sajit
modified on Wednesday, November 11, 2009 6:00 AM
|
|
|
|
|
hi all,
I need to know How to edit and manage group policy through C# and ASP.Net application.I want to get all users an groups in the active directory and I already did this.I then want to assign group ploicy to groups and OU(organizational unit).
I&S
|
|
|
|
|
This question isn't really answerable is a forum environment. The description of everything you ahve to do would be a larger article or a small books worth. Far beyond the capacity of a few forum posts. All I can do is direct you to start researching the System.DirectoryServices namespace to get an understanding of the classes you're going to use to manipulate Active Directory. From there, you can come up with a design for your ASP.NET app.
|
|
|
|
|
Thanks Dave Kreskowiak
I searched for Active Directory services and read a book about it and the group policy(GPO scripting of it).
|
|
|
|
|
Hello
My problem is updating multiple rows of a single column with different using update command from C#
Regards Usman Ahmad
|
|
|
|
|
Would you care to actually explain the problem and the code you're using or should we just guess at the million or so possible issues you have?
|
|
|
|
|
Thanks to every one who replied me. I have solve the problem.
regards
Usman Ahmad
|
|
|
|
|
Hi Guys,
i need the NewRowNeededEvent of the DataGridView. So i set the VirtualMode Property to true.
But if this property is set to true, i need to set the cell value by myself, otherwise it vanisches if i leave the cell.
So i've tried to save the value - the cell is a ComboBox where i select a value - in the CellValidatinEvent.
But it doesnt work. The value property of the cell is not changing it is still null.
Here is some code that you can understand what i mean.
<br />
<br />
private void aufwandDataGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)<br />
{<br />
DataGridViewComboBoxCell cell =<br />
aufwandDataGridView.CurrentCell as DataGridViewComboBoxCell;<br />
<br />
cell.ReadOnly = false;<br />
<br />
if (aufwandDataGridView.IsCurrentCellDirty)<br />
{<br />
<br />
aufwandDataGridView.CommitEdit<br />
(DataGridViewDataErrorContexts.Commit);<br />
}<br />
<br />
cell.Value = e.FormattedValue;<br />
}<br />
Can anyone please help me?
Kind regards and thx in advance
Me
|
|
|
|
|
Ok it's because of the VirtualMode property that i can't set the cell.value so easily.
But how can i set the cell.value if the cell is not databound?
|
|
|
|
|
Ok i've given up on virtual mode.
now i search for an event that occurs at the same time like newrowneeded
|
|
|
|
|
hi
at first excuse me because of my poor english i have written a program for sending an image or for video conference via internet with sockets and i am using tcp protocols my problem is that when i test program on my computer it works fine but when i test it over internet with between two pcs the reciver cant recieve image correctly minwhile i am using dial up
connection i dont know where is the problem perhaps it is because of low speed of internet i changed the buffer size to 512 1024 4096 and it didnt change. or i maybe should compress or encode image i dont know .please please help me with this problem.
here is the code for sending an image :
private void button2_Click(object sender, EventArgs e)
{
byte[] bytes;
using (MemoryStream ms = new MemoryStream())
{
pictureBox1.Image.Save(ms,ImageFormat.Jpeg);
pictureBox2.Image = pictureBox1.Image;
bytes = ms.ToArray();
ms.Close();
}
startcapturing(bytes);
}
private void startcapturing(byte[] bytes)
{
int i = 0;
byte[] dataBuffer = new byte[128];
int index = 0;
byte[] loop = new byte[128];
loop = System.Text.Encoding.ASCII.GetBytes(((bytes.Length / 128) + 1).ToString());
label4.Text = ((bytes.Length / 128) + 1).ToString();
if (serverSocket != null)
{
try
{
rc = clientSocket.Send(loop, SocketFlags.None);
while(i<bytes.length)
{
="" for="" (index="0;" index="" <="" databuffer.length;="" index++)
="" if="" (i="">= bytes.Length)
{
dataBuffer[index] = 0;
}
else
{
dataBuffer[index] = bytes[i];
i++;
}
}
rc = lientSocket.Send(dataBuffer,SocketFlags.None);
}
}
catch (Exception err)
{
MessageBox.Show(err.Message.ToString()+"here");
}
}
}
here is the code for client to recieve image:
if (clientSocket != null)
{
while(true)
{
while (true)
{
int counter = 0;
msr = new MemoryStream();
byte[] recv = new byte[128];
try
{
rc = clientSocket.Receive(recv, SocketFlags.None);
try
{
counter = Convert.ToInt32(System.Text.Encoding.ASCII.GetString(recv, 0, recv.Length));
}
catch { }
while (counter > 0)
{
rc = clientSocket.Receive(recv, SocketFlags.None);
counter--;
msr.Write(recv, 0, recv.Length);
}
}
catch (Exception e)
{
}
try
{
pictureBox1.Image = Image.FromStream(msr);
msr.Close();
}
catch(Exception e)
{
}
break;
}
}
}
else
{
StatusLabel1.Text = "Unable to establish connection to server!";
BtnDC_Click(null, null);
}
}
i beg you help me
|
|
|
|
|
I don't understand the full code, but I must say the problem is probably with the send or the Receive.
I am not sure if the Send can send partial data, but receive surelly do.
For example: You send 128 bytes.
The connection is local, you get 128 bytes.
But, if the connection is remote, you can:
Receive 10 bytes.
Then, receive 20 bytes.
+ 10 bytes... until you finally receive all the buffer (the 128 you expected).
So, you must check this.
Also, I think a better approach is:
Instead of writing everything to a memorystream and them sending the memorystream buffer, get the socket stream (socket.GetStream()) and save the image directly to the socket stream.
Then, on the other side, call Image.FromStream(socket.GetStream())
|
|
|
|
|
thanks sockets doesnt have Getstream() methode only tcp client has it
please if you guide me write more cause i am new to c#
thanks in advance
|
|
|
|
|
Well... I usually use sockets by TcpClient in C#... but, the same way, I am not sure about send, but when reading, you must do something like this:
Instead of read(buffer, 0, 128)
you set:
int totalRead = 0
int count = 128;
while(count > 0)
{
int actualRead = socket.Read(buffer, totalRead, count);
if (actualRead <= 0)
throw new Exception("Connection lost");
totalRead += actualRead;
count -= actualRead;
}
|
|
|
|
|
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
oh my god you solved my problem oh my god thank you thank you thanks
please please let me kiss your foot
i wont forget your name paulo zemek i wont forget you
thanks thanks a milion thanks a bunch
let me let me kiss your foot
i am really crying here
thanks thanks ..................................
................................................
.................................................
..................................................
...................................................
|
|
|
|
|
Hi,
I have coded few methods in C++ language. These methods are to be used in C#.NET . I guess I need to convert the .CPP file(C++ code) into DLL and then import the methods in C#.
I made a Win32 project and converted the exe(C++ code) into unmanaged C++ DLL.
Then I tried to call its method in C#.NET as :
using System.Runtime.InteropServices;
public partial class CDLL : System.Web.UI.Page
{
[DllImport("C:\\Project1\\TestProject\\Debug\\TestProject.dll", EntryPoint = "testMethod", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
public static extern void testMethod();
protected void Page_Load(object sender, EventArgs e)
{
testMethod();
}
}
After running the above code i am getting error like : Unable to find an entry point named 'testMethod' in DLL 'C:\Project1\TestProject\Debug\TestProject.dll'. Can any one suggest how to run the above code successfully.
Thanks.
|
|
|
|
|
Pranav Thakur wrote: After running the above code i am getting error like : Unable to find an entry point named 'testMethod' in DLL 'C:\Project1\TestProject\Debug\TestProject.dll'. Can any one suggest how to run the above code successfully.
Write a dll that exports testMethod, that's what the error is telling you.
I would also not use full paths, just let the dll be in the same dir as the exe.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|