本文介绍了如何在MFC应用程序的其中一列中生成序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试在序列号列中生成序列号,但我不知道应该在哪里放置该代码。因为我已经使用序列号,设备列表等字段制作了表格,但我需要序列号才能拥有自然数字,例如每个新行都会有唯一的序列号。

我无能为力如何解释你更多,所以请告诉我[email protected]以便我可以与你分享我的工作



我尝试过:



我尝试在所有列的末尾添加生成数字的常规代码。像往常一样没有任何问题。我对这个MFC很新,所以请帮助我,我需要尽早提交这个

I have been trying to generate serial number in Serial number column but I have no clue where should i put that code. As in i have made the table with fields like serial number, device list , etc but i need serial number to have natural numbers for example every new row will have unique serial number.
I am clueless how to explain you more so please ping me on [email protected] so that i can share my work with you

What I have tried:

I have tried putting the normal code for generating numbers at the end of all the columns. As usual nothing is working out.Iam new to this MFC so please help me i need to submit this as early as possible

推荐答案

int getSerialNumber()
{
  //get from persistent store like registry, web-service or disk
  int lastSerial = getLastSerial();
  //get the next, simplest way is +1
  int nextSerial = computeNextSerial( lastSerial );

  //save in persistent store
  saveLastSerial( nextSerial );

  return nextSerial;
}


这篇关于如何在MFC应用程序的其中一列中生成序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 23:59