|
Shame - without the country code, my phone number is 11 digits. Your validation kind of sucks.
|
|
|
|
|
Pete O'Hanlon wrote: 11 digits How about +44 instead of 0?
Your time will come, if you let it be right.
|
|
|
|
|
That's why I stated "without the country code"...
|
|
|
|
|
Ah I missed it completely.. , a "01202" case perhaps?
Never mind.
Your time will come, if you let it be right.
|
|
|
|
|
I have a DataGridView with the 3rd column defined to show a ComboBox.
However, I'm not able to get the drop-down combo box in the 3rd column to display anything.
Here's a snippet of my code:
string[] row = new string[2];
row[0] = "Value 1";
row[1] = "Value 2";
mDataGridView.Rows.Add(row);
DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell();
cell.Items.Add("Item 1");
cell.Items.Add("Item 2");
mDataGridView.Rows[0].Cells[2] = cell;
The data in the first 2 columns shows up just fine (i.e. Value 1 and Value 2).
But there is nothing that shows up in the drop-down combobox in the 3rd column. (I'd expect to see "Item 1" and "Item 2") in the drop-down combobox. I see the down-arrow on the combobox but when I click it, nothing happens.
What am I doing wrong?
Thanks
-Mike
|
|
|
|
|
works for me. Just tried it.
Make sure the third column is defined in the designer and set as a DatGridViewComboboxColumn.
It does react a little unnatural in the sense you need to click more than once to drop down the items.
I made a winforms app, dropped a DataGridView on it and only changed the Columns property (2x textboxcolumn, 1x comboboxcolumn). Then I used copy/paste on your code.
Hope this helps.
|
|
|
|
|
How to send the selected pdf files to the default printer, instead of merge.
http://www.codeproject.com/Articles/470190/PDF-Merger-and-Protector
|
|
|
|
|
You should ask in the Comments and Discussions for the article.
The author will be notified.
Asking here doesn't notify the author of the article and depends on the author "just happening to notice" this question.
A positive attitude may not solve every problem, but it will annoy enough people to be worth the effort.
|
|
|
|
|
Thank you, I notified the author.
|
|
|
|
|
To make my program portable I want to add the the needed .dll file as ressource and built it into the whole .exe file. Now I don't know how to get the path for the .dll file. I've got a function which needs as a parameter the path to the .dll file. Hope you understand my problem. I tried: http://www.codeproject.com/Articles/528178/Load-DLL-From-Embedded-Resource
But all I tried from this doesn't work.
modified 16-Dec-14 16:30pm.
|
|
|
|
|
|
Oh I see atm. Link above was the same link you posted. I tried this above. Doesn't work.
|
|
|
|
|
Janis Heller wrote: Doesn't work. Doesn't tell us anything.
|
|
|
|
|
By using the path from example nothing happens. No error occurs but the DLL doesnt get loaded because my function dont do anything (output).
|
|
|
|
|
I did this ages ago - the biggest issue I found was making sure I had the correct path to the embedded dll in the assembly - I think I resolved it by using 'something like' (this may not be the exact code, but you'll get the idea)
string[] resourceNames = this.GetType().Assembly.GetManifestResourceNames();
foreach(string resourceName in resourceNames)
{
System.Diagnostics.Trace.WriteLine(resourceName);
}
once you've gone through that to make sure you have the correct name you shouldn't have any issues
|
|
|
|
|
Hi,
I would like to ask, in C#, how can I convert any string to a 24 hexadecimal digits like this:
XXXX-XXXX-XXXX-XXXX-XXXX-XXXX
if the string was 1 character length or more or even more than 24 character length or even if it was 240 characters?
Thanks
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
It is all the same however many characters in the original. Just a question of taking successive groups of four bits and using the Int32.ToString[^] conversion on each set. Repeat as necessary.
|
|
|
|
|
|
|
I actually want to encrypt the processor ID and/or other hardware ID then convert it into a 24 character as a license key.
Technology News @ www.JassimRahma.com
|
|
|
|
|
Jassim Rahma wrote: want to encrypt
No, you want a hash.
|
|
|
|
|
I need to remove a handwriting signature from the pdf using itextsharp.
this handwriting signature can not be selected by mouse, i can access all the object buy this hand writing signature is not in the list of objects or signatures. how can i remove it?
here is part of my code to replace one of images. I need to replace image and signature.
public void ReplaceImage()
{
string pdfFilePath = Server.MapPath(".") + "/PDFFiles/Receipt.pdf";
string imageURL = Server.MapPath("/PdfImagesFiles") + "/img3.jpg";
string OutputFilePath = Server.MapPath("/PDFFiles/result.pdf");
PdfReader pdf = new PdfReader(pdfFilePath);
PdfStamper stp = new PdfStamper(pdf, new FileStream(OutputFilePath, FileMode.Create));
PdfWriter writer = stp.Writer;
var reader = new PdfReader(pdfFilePath);
var pdfContentByte = stp.GetOverContent(1);
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(imageURL);
PdfDictionary pg = pdf.GetPageN(1);
PdfDictionary res = (PdfDictionary)PdfReader.GetPdfObject(pg.Get(PdfName.RESOURCES));
PdfDictionary xobj = (PdfDictionary)PdfReader.GetPdfObject(res.Get(PdfName.XOBJECT));
Document doc = new Document();
if (xobj != null)
{
foreach (PdfName name in xobj.Keys)
{
PdfObject obj = xobj.Get(name);
if (obj.IsIndirect())
{
PdfDictionary tg = (PdfDictionary)PdfReader.GetPdfObject(obj);
PdfName type = (PdfName)PdfReader.GetPdfObject(tg.Get(PdfName.SUBTYPE));
if (PdfName.IMAGE.Equals(type))
{
PdfReader.KillIndirect(obj);//remove the object
writer.AddDirectImageSimple(img, (PRIndirectReference)obj);//add new image
}
}
}
}
stp.Close();
}
A.Hakak
|
|
|
|
|
If the signature is not its own object, its part of another one.
Now you have a situation where the signature is an image, part of a bigger image. You cannot remove it using iTextSharp alone.
You'd get the object that it's a part of, export that, do some image editing to "paint over" the signature, then use iTextSharp to replace the image in the PDF with the edited one.
If you're trying to do this automated, you're going to have an extremely difficult time getting the code to identify the signature and, just as difficult, separating that from the line that the signature is on.
Good luck. You're going to need it as I can't find a single example of anyone doing this.
|
|
|
|
|
The following Function gets called by a program running on several station in a workgroup. The file resides on a shared resources. I need to make this routine network safe so only one station can read and write the file at a time. The other stations should just wait until the file is not in use. I assume I must attempt open the file for read write access and lock other users out of the file. Not sure how this is done in C#
private static string GetNextCounter(string destpath, string address, int port, String XMLString)
{
if (Directory.Exists(destpath + "\\" + address.Replace(".", "-")))
{
}
else
{
string registerRepsonse = register(destpath, address, port, XMLString);
};
string nextCounter = File.ReadAllText(destpath + "\\" + address.Replace(".", "-") + "\\Counter.xml");
int nextCounterInt = Convert.ToInt32(nextCounter);
nextCounterInt = nextCounterInt + 1;
File.WriteAllText(destpath + "\\" + address.Replace(".", "-") + "\\Counter.xml", nextCounterInt.ToString());
return nextCounterInt.ToString();
}
|
|
|
|
|
Open the file exclusively for writing, that way it would be locked. It is also the most wrong way of keeping a sequential number synchronized over multiple stations.
Install a database-server, use a primary key - that is the only good option. That eliminates mucking with file-locking, mucking with getting the network-resource and potential concurrency problems.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|